updateLayersControl | R Documentation |
When adding additional base layers or overlay layers to an existing map,
updateLayersControl
will either update the existing layers control or
add a new one if map has none.
updateLayersControl(
map,
addBaseGroups = character(0),
addOverlayGroups = character(0),
position = "topleft",
...
)
map |
A |
addBaseGroups |
group names of base layers to be added to layers control. |
addOverlayGroups |
group names of overlay layers to be added to layers control. |
position |
position of control: "topleft", "topright", "bottomleft", or "bottomright". |
... |
Further arguments passed to |
A leaflet map
object.
library(leaflet)
map = leaflet() %>%
addProviderTiles("OpenStreetMap", group = "OSM") %>%
addProviderTiles("CartoDB.DarkMatter", group = "dark") %>%
addCircleMarkers(data = breweries91, group = "brew")
map # no layers control
map %>%
updateLayersControl(addBaseGroups = c("OSM", "dark"),
addOverlayGroups = "brew")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.