ol_geom_point | R Documentation |
Function to create a points layer to add to an OpenLayers Map object.
ol_geom_point(point.obj, mapping = ol_aes(), name = NULL, df = NULL, toggle.control = FALSE, fill = "#00FF00", fill.opacity = 1, marker = "pin", size = 0.5, label = NULL, label.params = list(), tooltip = NULL, tooltip.params = list())
point.obj |
SpatialPointsDataframe, SpatialPoints, or a matrix containing columns of point longitudes and latitudes, respectively. |
mapping |
list created by ol_aes. Used for aestheic mapping. |
name |
character Layer name. |
df |
data.frame with same number of rows as |
toggle.control |
logical indicating whether this layer will have a visibility toggle. |
fill |
character color string, or vector of color strings. Used
only if no |
fill.opacity |
numeric in [0,1]. Controls circle opacity if
no opacity provided in |
marker |
character. The 'pin' marker draws map pointers similar to most web map applications. The 'dot' or 'point' markers render as cicular points on the map. Other marker types are not supported by this method. |
size |
numeric point icon size scalar or vector scalars. Used
only if no |
label |
character vector of point feature labels. |
label.params, tooltip.params |
named lists (e.g., |
tooltip |
character vector of point feature tooltip popups. |
This function stores the data required to generate an OpenLayers
vector layer with features using Point
geometries.
See OpenLayers Point Documentation
for details.
A list object of class Layer.SpatialPoint
.
fill
size
ol_aes
,
ol_map
,
ol_geom_polygon
,
ol_geom_circle
,
ol_geom_line
,
ol_geom_icon
point.matrix <- matrix( c( -80.885+runif(10), 25.282618+runif(10) ), ncol=2 ) point.df <- data.frame( pt.type=sample(c("A","B"),10,replace=TRUE), pt.value=runif(10)*10 ) miami.map <- ol_map( center=c(-80.385790,25.782618), zoom=9 ) + streetmap() miami.points <- ol_geom_point( point.matrix, df=point.df, mapping=ol_aes(fill=pt.type,size=pt.value), name="Random Points of Interest", marker="pin", toggle.control=TRUE, tooltip=point.df$pt.type ) size.scale <- ol_scale_size_continuous( display=TRUE, draw.fill='green' ) fill.scale <- ol_scale_fill_discrete( c(B='red',A='green'), display=TRUE ) miami.points.map <- miami.map + miami.points + size.scale + fill.scale ## Not run: # Output to file and view ol_map2HTML( miami.points.map, 'Miami_points.html' ) browseURL('Miami_points.html') ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.