mapview provides a couple of special convenience functions for all supported spatial data types:
viewExtent
to view extents/bounding boxes of
objectssync
ing of multiple mapsThere are also a few raster-only specialty functions:
viewRGB
to view RGB (raster) imagesFor the following:
plainview
to view raster images without map
backgroundslideview
to compare two raster/RGB imagescubeview
to view 3D raster cubesplease refer to the individual help pages
(e.g. ?cubeview
)
This can be handy to check whether features overlap or to just check where things are roughly located (e.g. in case we have big data sets, e.g. raster stacks).
library(mapview)
library(leaflet)
library(plainview)
library(leafsync)
viewExtent(poppendorf, color = "red") + viewExtent(breweries)
sync
can be used to produce small multiples that are
synchronised. Meaning that if we zoom into one panel, all other panels
will also zoom. Additionally, the mouse position is also synced
(indicated via a red circle). sync
provides a very
convenient way to compare multiple attributes of the same feature
geometry set.
We can sync
all panels:
m1 <- mapview(breweries, zcol = "village", map.types = "Esri.WorldImagery")
m2 <- mapview(breweries, zcol = "brewery", col.regions = heat.colors)
m3 <- mapview(breweries, zcol = "founded", legend = TRUE)
m4 <- leaflet() %>% addTiles() %>% addCircleMarkers(data = breweries)
sync(m1, m2, m3, m4)
Any combination of panels:
We can also control the layout by specifying how many columns we want to have (rows will be automatically set):
latticeView
will render small multiples without
synchronising
latticeView(m1, m3)
viewRB
can be used to view true- or false-color raster
images. It expects a RasterStack
or
RasterBrick
and the default setting will render layer
combination 3-2-1
## Warning in CPL_crs_from_input(x): GDAL Message 1: +init=epsg:XXXX syntax is
## deprecated. It might return a CRS with a non-EPSG compliant axis order.
viewRGB(poppendorf, 5, 4, 3)