mapproj in r

Making maps with r using mapproj.

 

library(ggmap)

map <- get_map(location=’North America’, zoom=6)

ggmap(map)

 

What each line does:

Line 1 loads the ggmap library.

Line 2 fetches the terrain map graphic from Google’s server at the specified zoom level – higher is closer in.  Zoom level 6 is about the size of Texas or California.  Zoom 15 is about the level of a neighborhood and is the max.  Going higher does zoom in further but there is no background.  The location value seems to be able to take any value that google maps would take.  The image is stored as “map”.

Line 3 displays the map.

Another example

library(ggmap)

a <- get_map(location=’ft worth, tx’,zoom=12)
ggmap(a)