In this recipe, we will learn how to plot data on top of Google map images using a special package that connects to Google's Static Maps API.
First, we need to install the RgoogleMaps
package and a related package, rgdal
:
install.packages("rgdal") library(rgdal) install.packages("RgoogleMaps") library(RgoogleMaps)
We will use the londonair
example dataset for this recipe. This dataset contains annual average concentrations of particulate matter in London's atmosphere measured at 12 different air quality monitoring sites across the city (data source: London air website http://www.londonair.org.uk). So, let's load that too:
air<-read.csv("londonair.csv")