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. It was created to fill the gap of quick (not presentation grade) interactive plotting to examine and visually investigate both aspects of spatial data, the geometries and their attributes.
The main user relevant functions are:
mapview
- view potentially multiple spatial objects on a set of background mapsviewExtent
- view extent / bounding box of spatial objectsviewRGB
- view RGB true- or false-color images of raster objectslatticeView
&sync
- view small multiples of several potentially synchronised mapsslideView
- view two overlaid raster objects with a horizontal slider to hide/reveal one of themcubeView
- 3D view of raster data cubes (e.g. space-time cube) with keyboard control over position of slicesplainview
- view large rasters on a plain background (i.e. no background map)mapshot
- easily save maps (including leaflet maps) ashtml
orpng
(or other image formats)
Objects of the following spatial classes are supported:
- sf
- raster (Layer, Stack, Brick and SpatialPixels* / SpatialGridDataFrame)
- sp (Points, Polygons, Lines and their DataFrame version)
- satellite
In addition, mapview provides some extra leaflet compatible functionality:
addHomeButton
- add zoom-to-layer buttonsaddLogo
- add a logo (or any image really) to a mapaddFeatures
- add features to a map (sf or sp). This is features type agnostic, meaning the same function can be used for points, lines and polygonsaddMouseCoordinates
- add mouse cursor postion information when moving over the mapaddLargeFeatures
- add large data to a map that would otherwise make the leaflet map irresponsiveaddExtent
- add a polygon denoting the extent/bbox of a spatial object to a mappopupTable
,popupGraph
&popupImage
- popups of tables, grpahs and images for use with the leafletadd*
functions
For CRAN release version of mapview use
install.packages("mapview")
To install the development version install the devtools package.
devtools::install_github("r-spatial/mapview@develop")
The most basic call
mapview(breweries)
will produce a web map visualisation of the breweries data with the following components:
Please file bug reports and feature requests at https://github.com/r-spatial/mapview/issues
In case of Pull Requests, please make sure to submit them to the develop
branch of this repository.