Garnish/decorate leaflet or mapview maps.

Share:

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 repsective arguments and adds them to the map. Arguments must be named. Functions can be plain or charatcer strings.

Usage

1

Arguments

map

a mapview or leaflet object.

...

functions and their arguments to add things to a map.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
m <- leaflet() %>% addTiles()
garnishMap(m, "addMouseCoordinates") # same as
garnishMap(m, addMouseCoordinates)

## add more than one with named argument
library(raster)
m1 <- garnishMap(m, addMouseCoordinates, mapview:::addHomeButton,
                 ext = extent(breweries91))
m1

## even more flexible
m2 <- garnishMap(m1, addCircleMarkers, data = breweries91)
garnishMap(m2, addPolygons, data = gadmCHE, popup = popupTable(gadmCHE),
           fillOpacity = 0.8, color = "black", fillColor = "#BEBEBE")


## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.