Map Projections for R Shapefiles: United States

November 2, 2016
By

(This article was first published on R Tricks, and kindly contributed to R-bloggers)

Someone contacted me recently about the map projections used in my blscrapeR package. After a bit of web searching, I couldn’t find a really good list of map projections for the continental U.S. that could be used in R. This list is as much for my own reference as anyone else, but hope you find it useful.

Here’s my list of map projections that are appropriate to map the continental U.S. in R. DISCLAIMER: I have omitted many, if you like another, comment and I’ll add to the list. The full code is below in Gist form. There are many other projections listed here, I just displayed the ones I find most useful.

The Native Map Projection
U-g-l-y, you ain’t got no alibi!

# Default projection of the map can be found by running the following on the SpatialPolyGonsDataFrame.
raster::crs(county)

# Then apply the result to the CRS() functions.
us.map <- spTransform(state, CRS("+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"))

standardproj

Mercator Projection

# Mercator projection.
us.map <- spTransform(state, CRS("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0  
                                 +x_0=0.0 +y_0=0 +k=1.0 +units=m +no_defs"))

mercatorproj

Lambert Azimuthal Equal Area Projection

# Lambert Azimuthal Equal Area
us.mpa <- spTransform(state, CRS("+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 
                          +ellps=GRS80 +units=m +no_defs")) 

lambertaproj

Lambert Conformal Conic Projection

# Lambert Conformal Conic
us.mpa <- spTransform(state, CRS("+proj=lcc +lat_1=33 +lat_2=45 +lat_0=39 +lon_0=-96 
                                 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs")) 

lambertconicalproj

Albers Equal Area Projection

# Albers Equal Area
us.mpa <- spTransform(state, CRS("+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 
                                 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs")) 

alberse

Albers Equal Area Conic Projection

# Albers Equal Area Conic
us.mpa <- spTransform(state, CRS("+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 
                          +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs")) 

albersequalareaconicproj

Full Code
Here's the full script I used, including all of the projection arguments, shapefile and mapping data.

To leave a comment for the author, please follow the link and comment on their blog: R Tricks.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)