How to combine Google maps and data in R

January 27, 2010
By

(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 his blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: 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.