O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To download and use Google maps of an area, follow these steps:

  1. Load the RgoogleMaps package:
> library(RgoogleMaps) 
  1. Determine the latitude and longitude of the location for which you need a map. In this recipe, you will get the map for the neighborhood of Seton Hall University in New Jersey, USA. The location is (lat, long) = (40.742634, -74.246215).
  2. Get the static map from Google Maps and then plot it as follows. The output of the map is shown after the code:
> shu.map <- GetMap(center = c(40.742634, -74.246215),     zoom=17) 
> PlotOnStaticMap(shu.map) 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required