Description Usage Arguments Functions Examples
This function produces a lattice like view of two or more maps. It is possible to sync
any combination of panels or all or none. For synchronising all panels it
is best to use the provided convenience function sync
.
1 2 3 4 5 6 7 |
... |
any number of mapview or leaflet objects or a list thereof |
ncol |
how many columns should be plotted |
sync |
whether to synchronise zoom and pan for certain elements.
Possible values are "all" (default) to sync all maps, "none" to disable
synchronisation or a list of panel numbers, e.g. |
sync.cursor |
whether to show cursor position in synced panels (default TRUE). |
no.initial.sync |
whether to sync the initial view (default TRUE). |
latticeview
: alias for ease of typing
sync
: convenience function for syncing maps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | if (interactive()) {
library(leaflet)
library(leafsync)
m1 = leaflet() %>%
addTiles() %>%
addPolygons(data = gadmCHE)
m2 = leaflet() %>%
addProviderTiles("Esri.WorldImagery") %>%
addCircleMarkers(data = breweries91,
color = "black",
opacity = 0.9,
fillColor = "white",
fillOpacity = 0.9)
# synced
sync(m1, m2)
sync(m1, m2, no.initial.sync = TRUE)
# not synced
latticeview(m1, m2)
latticeview(m1, m2, ncol = 1)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.