Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

CRAN Task View: Mapping tools and services

Maintainer: Contact: Jeff Hollister, Scott Chamberlain, hollister.jeff at Karthik Ram, Hadley Wickham, Ben
Marwick, Cory Nissen

This task view contains information about mapping and visualizing spatial data in R. The base version of R does not ship with many tools for mapping spatial data. Thankfully, there are an increasingly large number of tools for doing so, both with just R or javascript libraries. A list of available packages and functions is presented below, grouped by the type of activity. If you have any comments or suggestions for additions or improvements for this taskview, go to Github and submit an issue, or make some changes and submit a pull request. If you can't contribute on Github, send Jeff an email. If you have an issue with one of the packages discussed below, please contact the maintainer of that package. This task view is focused on mapping spatial data and less so on the foundations of working with spatial data in R. That material is covered in detail in the Spatial Task View. There is some overlap between the two task views, but an effort has been made to reduce redundancy so that these task views compliment one another.

Mapping tools in R


  • cartodb: CartoDB R client. Not on CRAN, and hasn't been active for a while. Source on Github
  • cartographer: Interactive maps in R using d3-carto-map. Source on Github
  • ggmap: Visualization of spatial data and models on top of Google Maps, OpenStreetMaps, Stamen Maps, or CloudMade Maps using ggplot2. Source on Github
  • leaflet: Client for the JavaScript library Leaflet.js. Uses htmlwidgets to provide structure for output. Integrated with R Console, RStudio, and R Markdown v 2. Can include interactive maps with markdown documents as well as with shiny apps. Source on Github
  • leafletR: Another client for the JavaScript library Leaflet.js. Basic mapping functionality to combine vector data and online map tiles from different sources. Source on Github
  • mapview: This package provides wrappers to the leaflet package that simplifies the creation of maps. Stated purpose of the package is to facilitate interactive viewing of spatial data in R. Source on Github.
  • micromap: This group of functions simplifies the creation of linked micromap plots, and uses ggplot2 plotting framework. Source on Github.
  • OpenStreetMap: An R client for fetching raster images via the Open Street Maps API.
  • plotGoogleMaps: This package provides a interactive plot device for handling the geographic data for web browsers. It is designed for the automatic creation of web maps as a combination of users' data and Google Maps layers.
  • quickmpar: Quick visualization of sp and raster objects. Provides basic interactivity including zooming and panning as well as identifying features. Source on Github
  • rasterVis: Package for enhanced visualization of raster data. Source on Github
  • Rgooglemaps: Query Google static maps, and use the map as a background image to overlay plots within R. Source on Github
  • rMaps: A general purpose wrapper around main Javascript mapping libraries, including Leaflet, Datamaps, and Crosslet. Source on Github
  • sp: Core spatial package in R with basic spatial data manipulation methods. Most spatial analysis packages reuse the classes and methods provided by sp. Plotting capability in sp is provided through plot methods. More advanced plotting based on lattice. Source on GitHub
  • tmap: Package provides an approach to build thematic maps (e.g. chloropleth or bubble maps). Utilizes a grammar of graphics syntax. Source on GitHub

Projecting Data

Coordinates for spatial data can come in many different flavors with different units, datum, projections, and more. Many of the tools will visualize your data regardless of the native coordinate reference system; however, most (all?) of the javascript libraries assume some flavor of latitude-longitude, thus if your data are projected they need to be transformed back to geographic coordinates prior to mapping. For most mapping and visualization efforts unprojected data (often displayed in Web Mercator/EPSG::3857) is fine; however, if accurate area, length, or distance measurements are required through interacting with the map, then projections need to be considered. A discussion of projections and coordinate systems is beyond the scope of this task view. To learn more a good starting place is NCEAS' Overview of Coordinate Reference Systems in R. This more general discussion of projection from the USGS is also good.

Once you know that you need to transform you data there are several options:

  • sp: The function spTransform (and methods in rgdal) is the workhorse function for spatial transformations of vector data and it uses PROJ.4 arguments to specify the transformations. Accepted inputs are provided by the spTransform methods in rgdal. Source for sp on GitHub. Source for rgdal on R-Forge.
  • mapproj: This package provides a function to convert two vectors representing longitude (x) and latitude (y) to projected coordinates.
  • PBSmapping: The function convUL will transform coordinates between Universal Transverse Mercator (UTM) and longitude-latitude. A data frame with a projection attribute is required input. Source on Google Code


Geocoding is the process of converting address or place name information into geographic coordinates. Most of these have somewhat restricted Terms of Service(TOS). Be sure to read those carefully prior to use. Links for the TOS are provided.

Map Data

There are *many* possible sources and formats of data to use as base layers, so this list will most certainly be incomplete. Details for reading and writing most types of spatial data are already included in the Analysis of Spatial Data Task View, thus this list will focus on additional sources or features not discussed in that task view.

  • geojsonio: Provides utility for working with geojson data in R. Includes functions to convert sp objects, lists, and character to geojson format.
  • geonames: functions for working with geonames, a geographical database that covers all countries and contains over eight million place names
  • maps: Collection of coarse scaled for the US, some European countries, and a world map. Stored as `map` objects and various other geographic datasets. Location information in decimal degrees. Needs conversion to work with visualization from sp, ggmap, etc. Code for projections and additional maps in packages mapproj mapdata.
  • openadds: An R client for Openaddresses. The Openaddresses data comes in a variety of formats and this package provides common interface to simplify working with it in R. Source on Github
  • osmar: Package for interacting with the Open Street Map API in R. Functions for converting an open street map object into sp or igraph objects. Source on R-Forge.
  • prism: Accesses climate data from PRSIM. Also provides some basic plotting and mapping functions.
  • rworldmap: Set of functions to create country based world maps. Allows for joining of user specified data and can display chloropleth, gridded, bubble plot, bar charts, or pie charts. Data stored as `sp` objects. Source on Google Code.
  • tigris: Access US Census TIGER shapefiles directly in R. This package is currently in active development.
  • USAboundaries: provides spatial objects with the boundaries of states or counties in the United States of America from 1629 to 2000. It provides data from the Atlas of Historical County Boundaries.
  • UScensus2010: Functions to facilitate accessing data from the 2010 US Census using a suite of packages. Includes spatial data for census geographies (e.g. tracts, blocks, block groups, etc.). This packages is the third in a series of related package suites: UScensus1990blkgrp and UScensus2000.

CRAN packages:

Related links:


CRAN Task View for mapping tools



Code of conduct





No releases published


No packages published

Contributors 4