Methods to view spatial objects interactively.
Interactive viewing of spatial objects in R
The online manual for mapview can be found at
For CRAN release version of mapview use
To install the development version install the devtools package.
devtools::install_github("environmentalinformatics-marburg/mapview", ref = "develop")
mapview is an R package created to help researchers during their spatial data analysis workflow. It provides functions to very quickly and conveniently create interactive visualisations of spatial data.
mapview was created o fill the gap of quick (not presentation grade) interactive plotting to examine and visually investigate spatial data. So far, one had to either:
The main workhorse function is
mapView() and is currently defined for:
mapview is in large parts based on RStudios leaflet package, though in order to aid general spatial analysis workflow, we have added a few special functions.
For small to moderately sized spatial objects, a call to
mapView() will return an object of class
mapview. This class has 2 slots:
NOTE: For big spatial objects, only the map widget is returned. The distinction between small/moderate and big is made with respect to the number of features. The thresholds are 20k features for points and 30k features for polygons and lines. These values can be adjusted by setting the respective options.
mapView() provides five base layers between which one can toggle:
A preview of possible leaflet layers to use with mapview can be found here
Furthermore, a mouse coordinates strip is displayed at the top of the map giving information about the current mouse position and zoom level. Additionally, if the installed leaflet version permits, a scale bar is provided and labels are shown when hovering over a feature.
Depending on the object and/or argument settings one or several layers are created (each with or without it’s own legend) that can also be toggled. Note that in order to render properly, all layers need to be re-projected to leaflet’s underlying web mercator projection
+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs
which in the case of large Raster* objects or Spatial objects with lots of features can be time consuming.
for a brief introduction how to use projected maps with mapview
Please file bug reports and feature requests at https://github.com/environmentalinformatics-marburg/mapview/issues