Skip to contents

Mapview

Mapview is an excellent R package for interactive maps. Although the packages have a lot in common, the focus is different:

  • tmap focusses on thematic mapping with a syntax that is based on the grammar of graphics and is therefore popular for education purposes;
  • mapview focuses on fast exploration of spatial data and has more interactive features.

Modes / platforms

  • tmap offers two modes: “plot” and “view” (but is extendable, see https://github.com/r-tmap/tmap.deckgl).
  • mapview supports three modes, which they call platforms: “leaflet”, “leafgl”, and “mapdeck”.

tmap “view” (with tm_view(use_WebGL = FALSE)) is similar to mapview “leaflet” tmap “view” (with tm_view(use_WebGL = TRUE)) is similar to mapview “leafgl”

tmap does not offer a mode using Mapbox yet.

Default maps

This is the default output of mapview:

This is the default output of tmap:

tmap_mode("view")
#>  tmap mode set to "view".
qtm(World) # qtm stands for 'quick thematic map'

Choropleth

mapview(World, zcol = "HPI")