How can we use google maps in R?

r
datavisualization

#1

Hello,

I wanted to play a little with google maps. How can I use/integrate Google maps into R?

Thanks


#2

@Mark,

You can use the ggmap library->

install.packages( “ggmap”)
library(ggmap)

Now suppose You want to look at Italy’s map, use->

qmap(‘Italy’)

You would get->

Hope this helps!


#3

nice one . also use geocode() and qmap functions

geocode(“Bandra”)
Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Bandra&sensor=false
lon lat
1 72.83625 19.06069

qmap(“Bandra”,zoom=15)
Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=Bandra&zoom=15&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false

also see this

http://cran.r-project.org/web/views/Spatial.html

If the user wishes to place a map backdrop behind other displays, the the RgoogleMaps package for accessing Google Maps™ may be useful. ggmap may be used for spatial visualisation with Google Maps and OpenStreetMap. The plotGoogleMaps package provides methods for the visualisation of spatial and spatio-temporal objects in Google Maps in a web browser. plotKML is a package providing methods for the visualisation of spatial and spatio-temporal objects in Google Earth. A further option is leafletR, which provides basic web-mapping functionality to combine vector data files and online map tiles from different sources