Quickly and conveniently create interactive visualisations of spatial data with or without background maps. Attributes of displayed features are fully queryable via pop-up windows. Additional functionality includes methods to visualise true- and false-color raster images, bounding boxes, small multiples and 3D raster data cubes.
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 maps
viewExtent- view extent / bounding box of spatial objects
viewRGB- view RGB true- or false-color images of raster objects
sync- view small multiples of several potentially synchronised maps
slideView- view two overlaid raster objects with a horizontal slider to hide/reveal one of them
cubeView- 3D view of raster data cubes (e.g. space-time cube) with keyboard control over position of slices
plainview- view large rasters on a plain background (i.e. no background map)
mapshot- easily save maps (including leaflet maps) as
png(or other image formats)
Objects of the following spatial classes are supported:
In addition, mapview provides some extra leaflet compatible functionality:
addHomeButton- add zoom-to-layer buttons
addLogo- add a logo (or any image really) to a map
addFeatures- add features to a map (sf or sp). This is features type agnostic, meaning the same function can be used for points, lines and polygons
addMouseCoordinates- add mouse cursor postion information when moving over the map
addLargeFeatures- add large data to a map that would otherwise make the leaflet map irresponsive
addExtent- add a polygon denoting the extent/bbox of a spatial object to a map
popupImage- popups of tables, grpahs and images for use with the leaflet
For CRAN release version of mapview use
To install the development version install the devtools package.
The most basic call
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.
methodto specify the method used for resampling of raster data. #123
zcolwas supplied. #124
addMouseCoordinates has gained argument 'style' to specify whether to show 'basic' (lat, lon, zoom) or 'detailed' (x, y, epsg, proj4, lat, lon, zoom) information. Factory-fresh default is 'detailed'.
addLogo has gained argument 'alpha' to set the opacity of the image.
Someone draws quickest...
added new method for list of objects so that we can do mapview(list(x, y, z)) which is great for computational outputs such as lapply.
slideView has gained arguments 'label1' and 'label2' to supply slider names for the respective images, img1 and img2.
new popup layout (making more use of the space available).
added new function addLargeFeatures to render large datasets of up to ~100k features which is used automatically. To lower/elevate the threshold use maxpoints = ... (See ?mapview for details).
mapview methods for all basic sf classes (XY/sfg, sfc, sf)
added support for sf to "+"
we can now render features/objects with arbitrary CRS (without map background) by setting 'native.crs = TRUE'.
mapview will now decide which default base map to use based on average luminence of rendered colors.
mapview now provides subtle highlighting of polygons (changing opacity slightly) and lines (changing thickness).
plainView, slideView and cubeView have gained argument legend. default is TRUE. Legends only available for non-RGB methods!
new data sets:
data sets 'breweries91', 'gadmCHE' and 'atlStorms2005' have been deleted and moved to leaflet.
@objectwill be of class sf (regardless of input class).