mapview (version 2.7.0)

garnishMap: Garnish/decorate leaflet or mapview maps.

Description

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.

Usage

garnishMap(map, ...)

Arguments

map

a mapview or leaflet object.

...

functions and their arguments to add things to a map.

Examples

Run this code
# 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