
Last chance! 50% off unlimited learning
Sale ends in
This function provides a versatile interface to add components to a
leaflet or mapview map. It takes functions such as "addMouseCoordinates"
or addLayersControl
and their respective arguments and adds
them to the map. Arguments must be named. Functions can be plain or
character strings.
garnishMap(map, ...)
a mapview or leaflet object.
functions and their arguments to add things to a map.
# NOT RUN {
library(leaflet)
library(leafem)
library(leafpop)
m <- leaflet() %>% addProviderTiles("OpenStreetMap")
garnishMap(m, leafem::addMouseCoordinates, style = "basic")
## add more than one with named argument
library(raster)
m1 <- garnishMap(m, leafem::addMouseCoordinates, leafem::addHomeButton,
ext = extent(breweries))
m1
## even more flexible
m2 <- garnishMap(m1, addPolygons, data = franconia,
popup = leafpop::popupTable(franconia),
fillOpacity = 0.8, color = "black", fillColor = "#BEBEBE")
garnishMap(m2, addCircleMarkers, data = breweries)
# }
Run the code above in your browser using DataLab