How to combine Google maps and data in R

January 27, 2010

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

Every good artist needs a canvas, and when it comes to displaying geographic data placing those data in context — on a map — makes all the difference. A new package for R from Markus Loecher, RgoogleMaps, allows you to download a street or satellite map from Google simply by specifying the bounding latitude/longitude coordinates. (You need to sign up for a free Google API key first, though.) You can then overlay data from objects in R, using tools provided to convert to the map-based coordinate system. Here’s an example from the package vignette overlaying the locations of faults (provided as data in the geomapdata package) on a satellite map:

Satellite map


You can find the commands to create this map in R, along with other examples, in the package vignette linked below.

RgoogleMaps package: Vignette: Plotting on Google Static Maps in R (PDF) (via @DataJunkie)

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: ,

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)