| ol_geom_circle | R Documentation |
Function to create a circle layer to add to an OpenLayers Map object.
ol_geom_circle(circle.obj, mapping = ol_aes(), name = NULL, df = NULL, toggle.control = FALSE, fill = "#00FF0090", fill.opacity = 0.5, lwd = 1, ol.lty = list(), color = "#000000", label = NULL, label.params = list(), tooltip = NULL, tooltip.params = list())
circle.obj |
matrix containing three columns: center longitude,
center latitude, and radius respectively. Each row yields a
single |
mapping |
list created by ol_aes. |
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 |
lwd |
numeric circle border width. Used only if no |
ol.lty |
(experimental) numeric vector with length > 1, or
|
color |
character border color string, or vector of color strings. Used
only if no |
label |
character vector of length |
label.params, tooltip.params |
named lists (e.g., |
tooltip |
character vector of length |
This function stores the data required to generate an OpenLayers
vector layer with features using circle
geometries.
See OpenLayers Circle Documentation for details.
A list object of class Layer.Circle.
fill
color
lwd
ol_lty (experimental; See OpenLayers
ol/style/Stroke Documentation,
'lineDash' property for more information.)
ol_aes,
ol_map,
ol_geom_polygon
miami.circles <- matrix(
c(
-80.885+runif(10), #Longitudes
25.282618+runif(10), #Latitudes
rnorm(10,2000,500) # Radii in meters
),
ncol=3
)
aesthetic.df <- data.frame(
type=sample(c("A","B"),10,replace=TRUE),
value=runif(10)*10
)
miami.OSM.basemap <- ol_map(
center=c(-80.385790,25.782618),
zoom=9
) +
streetmap()
circle.layer<-ol_geom_circle(
miami.circles,
df = aesthetic.df,
mapping=ol_aes(fill=type),
lwd=2,
name="Meaningless Miami Circles",
toggle.control=TRUE,
color="#000000FF",
tooltip=sprintf("%1.2f",aesthetic.df$value)
)
circle.fill <- ol_scale_fill_discrete(
display=TRUE,
preserve.opacity=TRUE
)
circles <- miami.OSM.basemap + circle.layer + circle.fill
## Not run:
# Output to file and view
ol_map2HTML(
circles,
'miami_circles.html',
map.heading="Miami Shapes",
map.note="Note: Mouseover popup values are
independent of shape size & color."
)
browseURL("miami_circles.html")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.