ggmap in R

It is a package interfacing ggplot2 and RGoogleMaps.

For details read this article and here is the cheatsheet.

There are two steps in making a map.

  • download raster data for the map with get_map()
  • plot with the ggmap() and overlay with layers

Raster data is downloaded with:

  • location of center
  • zoom factor: 3=continent, 10=city, 21=building

Location specification can be done with:

  • address OR
  • lon/lat longitude and latitude

maptype in ggmap:

  • satellite
  • roadmap
  • hybrid

Geographic coordinates can be obtained with geocode() function.



## Loading required package: ggplot2

site <- geocode("Pokhara")

## Information from URL :

Pokhara<- ggmap(get_map(location=site, source="google", zoom=10), extent="panel")

## Map from URL :,83.995588&zoom=10&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false


Fig 1. Pokhara


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s