Title: | Small Multiples for Leaflet Web Maps |
---|---|
Description: | Create small multiples of several leaflet web maps with (optional) synchronised panning and zooming control. When syncing is enabled all maps respond to mouse actions on one map. This allows side-by-side comparisons of different attributes of the same geometries. Syncing can be adjusted so that any combination of maps can be synchronised. |
Authors: | Tim Appelhans [aut, cre], Kenton Russell [aut], Christoph Stepper [ctb], Jan Pieter Wagmeester [ctb] (Leaflet.Sync plugin) |
Maintainer: | Tim Appelhans <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1.9002 |
Built: | 2024-11-17 03:09:25 UTC |
Source: | https://github.com/r-spatial/leafsync |
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
.
latticeView( ..., ncol = 2, full.height = TRUE, sync = "none", sync.cursor = FALSE, no.initial.sync = TRUE, between = list(x = "2px", y = "2px") ) latticeview(...) sync( ..., ncol = 2, full.height = TRUE, sync = "all", sync.cursor = TRUE, no.initial.sync = TRUE, between = list(x = "2px", y = "2px") )
latticeView( ..., ncol = 2, full.height = TRUE, sync = "none", sync.cursor = FALSE, no.initial.sync = TRUE, between = list(x = "2px", y = "2px") ) latticeview(...) sync( ..., ncol = 2, full.height = TRUE, sync = "all", sync.cursor = TRUE, no.initial.sync = TRUE, between = list(x = "2px", y = "2px") )
... |
any number of mapview or leaflet objects or a list thereof |
ncol |
how many columns should be plotted |
full.height |
|
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). |
between |
a named list with components "x" and "y" specifying the space between panels in pixels . "x" refers to CSS property "margin-right", "y" refers to CSS property "margin-top". Default is 'list(x = "2px", y = "2px")'. |
latticeview
: alias for ease of typing
sync
: convenience function for syncing maps
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) }
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) }