R365: Day 31 – RgoogleMaps

While looking around at different mapping packages, I found a cool package that pulls map data off of Google Maps, allowing you to make really nice looking figures. Some of the cool things you can do include making bubble maps, like this one of cadmium levels around the river Meuse in the Netherlands:

cadmium

library(sp)
 data("meuse", package = "sp", envir = environment())
 m<-bubbleMap(meuse,zcol='cadmium');

Or color-coded maps, like this one showing leukemia levels in upstate NY in the early 1980’s.

Rplot08

library(RgoogleMaps)
 data("NYleukemia", envir = environment())
 population <- NYleukemia$data$population
 cases <- NYleukemia$data$cases
 mapNY <- GetMap(center=c(lat=42.67456,lon=-76.00365), destfile = "NYstate.png",
 maptype = "hybrid", zoom=8)
 ColorMap(100*cases/population, mapNY, NYleukemia$spatial.polygon, nclr=9,add = FALSE,
 alpha = 1, log = TRUE, location = "bottomleft")

This blog post was super useful to explore beyond the basics of RgoogleMaps.

 


Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s