Mapping America’s wind turbines using Google Maps and R

Posted on Updated on

A year ago the United States Geological Survey produced a database which contained information about more or less every wind turbine in America. I will be writing a post or two analyzing this data shortly. But for now I will give a quick explainer of how to produce a map of the locations of America’s wind turbines using Google Maps and R.

First, we need to get the data. This is data series 817 from USGS. I will create a map of the locations of the wind turbines using the R package ggmap, which lets you map stuff using Google Maps etc. This package uses the same syntax as ggplot2, so if you are wise enough to use ggplot2 it is easy to use. However, the code to produce the map is simple enough.

To read the raw data in, we just need the following:

require(ggmap);require(stringr)
options(stringsAsFactors = F)
### Download and unzip http://pubs.usgs.gov/ds/817/downloads/USGSWind_Turbine_03_2014.zip
#### Then convert to a csv file and load it in
raw <- read.csv("USGSWind_Turbine_03_2014/Onshore_Industrial_Wind_Turbine_Locations_for_the_United_States_to_March_2014.csv",
                na.string = "-99999")
### Remove the decommissioned turbines
raw <- subset(raw, decommiss != "yes")

Now, we need to map it using ggmap. Here is the code to produce a simple point map of the locations of America’s wind farms:

map <- get_map(location = 'United States', zoom = 3, maptype = "terrain")

ggmap(map)+
  geom_point(aes(long_DD  , lat_DD  ), data = raw)+
  xlim(c(-125, -60))+
  ylim(c(20,50))

This produces an acceptable map. You can obviously fiddle with the above code to get something better.

map_base

Alternatively, we might want to use the satellite map, which is done by switching the “mattype” option:

map <- get_map(location = 'United States', zoom = 3, maptype = "satellite")

ggmap(map)+
  geom_point(aes(long_DD  , lat_DD  ), data = raw)+
  xlim(c(-125, -60))+
  ylim(c(20,50))

map_satellite

How about individual wind farms?

Let’s look at Capricorn Ridge Wind Farm in Texas, which has over 400 turbines and a total capacity  of just over 600 MW.

First, we can show where the wind farm is in Texas, which is relatively easy because USGS lists the name of the wind farm each turbine is part of:

### Pull 
capRidge <- subset(raw, str_detect(site_name, "Capricorn"))

map <- get_map(location = c(capRidge$long_DD[1], capRidge$lat_DD[1]), zoom = 6, maptype = "terrain")

gg <- ggmap(map)+
  geom_point(aes(long_DD  , lat_DD  ), data = capRidge[1,], size = 3)
gg

capridge

We then might want to zoom in and see all of the turbines.


map <- get_map(location = c(capRidge$long_DD[1], capRidge$lat_DD[1]), zoom = 10, maptype = "terrain")

gg <- ggmap(map)+
  geom_point(aes(long_DD  , lat_DD  ), data = capRidge)
gg


capridge_turbines
You can obviously do a lot more with this data set, and I hope to. Check again in week or so and I hopefully will have.

Advertisements