Skip to Main Content

R: Mapping and Geospatial

Geospatial applications using the R programming language

Projections

 

 

 

 

 

 

 

Left: Unprojected (Longitude/Latitude) using World Geodetic System 1984 Datum (WGS84) (EPSG = 4326)
Right:  USA Contiguous Albers Equal Area Conic, USGS (EPSG = 5070 or 102003)

Planar and Geodesic: Sometimes, you'll see these terms used with respect to geospatial data.

  • Geodesic: Unprojected data; measured in degrees; distance measurements follow curvature of earth's surface. The first two CRS's in the table below are examples.
  • Planar: Projected data (earth is mathematically flattened); measured in meters or feet; distance is measured in straight lines on the flat surface.

A Few Useful EPSG Codes
​Use as the projection argument of tmaptools::set_projection()

CRS Projection Datum Units EPSG code
World Geodetic System 1984 Unprojected WGS84  degrees 4326
North American Datum 1983 [US Census data] Unprojected NAD83 degrees 4269
Pseudo-Mercator (Web Mercator; Spherical Mercator) [Google Maps, etc.] Mercator WGS84  meters 3857
World Robinson [Natl Geo world maps 1988-98] Robinson WGS84 meters 54030
World Van der Grinten [Natl Geo world maps 1922-88] Van Der Grinten I WGS84 meters 54029
World Eckert IV [equal area] Eckert IV WGS84 meters 54012
World Mollweide [equal area] Mollweide WGS84 meters 54009
World Equidistant Cylindrical Equidistant Cylindrical WGS84 meters 4087
North America Albers Equal Area Conic Albers NAD83 meters 102008
USA Contiguous Albers Equal Area Conic Albers NAD83 meters 5070 or
102003
North America Lambert Conformal Conic Lambert Conformal Conic NAD83 meters 102009
USA Contiguous Lambert Conformal Conic Lambert Conformal Conic NAD83 meters 102004
State Plane North Carolina Feet Lambert Conformal Conic NAD83 feet 2264
State Plane North Carolina Meters Lambert Conformal Conic NAD83 meters 32119
UTM zone 17N [good for NC] Transverse Mercator WGS84 meters 32617
British National Grid Transverse Mercator OSGB 1936 meters 27700
Asia North Albers Equal Area Conic [OK for China] Albers WGS84 meters 102025

Some set_projection() shortcut codes for world maps or for UTM zones.

  • "wintri"  Winkel Tripel, a projection used in world maps made by National Geographic since 1998. Balances nicely the distortion of area, shape, distance, and angle.
  • "igh" Interrupted Goode Homosoline, an equal-area projection for world maps that looks like an unpeeled orange peel, used in Rand McNally's Goode atlases.
  • "gall"  Gall Orthographic (a.k.a., Peters), an equal-area projection for world maps that dramatically distorts shape.
  • "utmXX(s)"  Universal Transverse Mercator. XX is the zone (see maps elsewhere in this guide). Add "s" for southern hemisphere. Using this with set_projection() is an alternative to looking up the EPSG code for the zone.

Example R code:

set_projection(shp, projection = "code")
set_projection(world_admin, projection = "wintri")

where shp is your geographic file and code is the shortcut code. See the documentation for more important information.