Using Web Services to Work with Geodata in R

Through collaborative mapping, a massive amount of data is accessible. Many individuals contribute information each day. The growing amount of geodata is gathered by volunteers or obtained via crowd-sourcing. One outstanding example of this is the OpenStreetMap (OSM) Project which provides access to big data in geography. Another online mapping service that enables the integration of geodata into the analysis is Google Maps. The expanding content and the availability of geographic information radically changes the perspective on geodata (Chilton 2009). Recently many application programming interfaces (APIs) have been built on OSM and Google Maps. That leads to a point where it is possible to access sections of geographical information without the usage of a complex database solution, especially if one only requires a small data section for a visualization. First tools for spatial analysis have been included in the R language very early (Bivand and Gebhardt, 2000) and this development will continue to accelerate, underpinning a continual change. Notably, in recent years many tools have been developed to enable the usage of R as a geographic information system (GIS). With a GIS it is possible to process spatial data. QuantumGIS (QGIS) is a free software solution for these tasks, and a user interface is available for this purpose. R is, therefore, an alternative to geographic information systems like QGIS (QGIS Development Team 2009). Besides, add-ins for QGIS and R-packages (RQGIS) are available, that enables the combination of R and QGIS (Muenchow and Schratz 2017). It is the target of this article to present some of the most important R-functionalities to download and process geodata from OSM and the Google Maps API. The focus of this paper is on functions that enable the natural usage of these APIs.

Jan-Philipp Kolb

Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at

CRAN packages used

RQGIS, osmdata, OpenStreetMap, ggplot2, ggmap, RgoogleMaps, leaflet, magrittr, tmap, mapview, mapdeck, lawn, googleway, RDSTK, RJSONIO, jsonlite, tmaptools, sf, OpenStreeetMap, mapmisc, opencage, curl, XML, osmplotr, sp, igraph

CRAN Task Views implied by cited packages

Spatial, WebTechnologies, Graphics, SpatioTemporal, gR, OfficialStatistics, Optimization, Phylogenetics, TeachingStatistics


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Kolb, "The R Journal: Using Web Services to Work with Geodata in R", The R Journal, 2019

BibTeX citation

  author = {Kolb, Jan-Philipp},
  title = {The R Journal: Using Web Services to Work with Geodata in R},
  journal = {The R Journal},
  year = {2019},
  note = {},
  doi = {10.32614/RJ-2019-041},
  volume = {11},
  issue = {2},
  issn = {2073-4859},
  pages = {6-23}