Unlimited learning, half price | 50% off
Get 50% off unlimited learning

⚠️There's a newer version (2.11.2) of this package.Take me there.

mapview

Interactive viewing of spatial data in R

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
  • latticeView & 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 html or png (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 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
  • popupTable, popupGraph & popupImage - popups of tables, grpahs and images for use with the leaflet add* functions

Installation

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")

Usage

The most basic call

mapview(breweries)

will produce a web map visualisation of the breweries data with the following components:

Contact

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.

Copy Link

Version

Install

install.packages('mapview')

Monthly Downloads

22,041

Version

2.4.0

License

GPL (>= 3) | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Tim Appelhans

Last Published

April 28th, 2018

Functions in mapview (2.4.0)

addFeatures

Type agnositc version of leaflet::add* functions.
cubeViewOutput

Widget output function for use in Shiny
mapviewOptions

Global options for the mapview package
addMapPane

Add additional panes to leaflet map to control layer order
addMouseCoordinates

Add mouse coordinate information at top of map.
poppendorf

Landsat 8 detail of Franconian Switzerland centered on Poppendorf
franconia

Administrative district borders of Franconia
trails

Selected hiking trails in Franconia
renderCubeView

Widget render function for use in Shiny
mapviewOutput

Create a mapview UI element for use with shiny
viewExtent

View extent/bbox of spatial objects interactively
renderMapview

Render a mapview widget in shiny
latticeView

View two or more (possibly synchronised) mapview or leaflet maps
addImageQuery

Add image query functionality to leaflet/mapview map.
mapshot

Save mapview or leaflet map as HTML and/or image
addLogo

add a local or remote image (png, jpg, gif, bmp, ...) to a leaflet map
mapviewColors

mapview version of leaflet::color* functions
mapview-class

Class mapview
popupTable

Create HTML strings for popups
mapview-package

Interactive viewing of spatial objects in R
mapView

View spatial objects interactively
print,mapview-method

Method for printing mapview objects
show,mapview-method

Method for printing mapview objects (show)
slideView

slideView
addStaticLabels

Add static labels to leaflet or mapview objects
coords2JSON

Convert a vector/matrix of coordinates to JSON format
coords2Lines

Convert points to SpatialLines*
addHomeButton

Add a home button / zoom-to-layer button to a map.
breweries

Selected breweries in Franconia
knit_print.mapview

Print functions for mapview objects used in knitr
cubeView

View a RasterStack or RasterBrick as 3-dimensional data cube.
garnishMap

Garnish/decorate leaflet or mapview maps.
coords2Polygons

Convert points to SpatialPolygons*
+

mapview + mapview adds data from the second map to the first
npts

count the number of points/vertices/nodes of sf objects
plainView

View raster objects interactively without background map but in any CRS
viewRGB

Red-Green-Blue map view of a multi-layered Raster object