Look up map projections in various standard formats

Geospatial data are usually only useful when associated with a spatial reference system (SRS). In a nutshell, this is the information needed to relate spatial coordinates in the dataset to actual positions on our planet, and by extension to relate spatial datasets to one another. When using programmatic tools to convert spatial data into a different SRS (e.g., when performing map projection), and even just to specify the SRS when this information is missing from the data source itself, you will sometimes need to express it in a standard format that the program can understand. There are several common ways to do this. Different software applications have traditionally used (and required) different formats, but most modern software libraries (including those associated with R, GRASS GIS, and GDAL) will support at least one of the following: EPSG codes, PROJ.4 strings, and the Well-known text (WKT) format. Each of these formats is described below.

For any of these formats, often the fastest solution is to enter relevant keywords (e.g., "Hawaii", "mercator", or "equal area") in the search box at http://www.spatialreference.org. Provided you can find the SRS that meets your needs, it's then simply a matter of clicking the link for the desired format and copying the information.

EPSG codes

Thanks to the now-defunct European Petroleum Survey Group, almost all common spatial reference systems have a recognized integer ID called an EPSG code. These codes are often the simplest way to identify a projection. If you know the correct EPSG code, it saves you from having to write down the projection in a more verbose form, which can be an error prone step. For example, the EPSG code for NAD83(HARN) / Hawaii zone 3 is simply written as EPSG:2784. However, the main limitation of these codes is that not all projections have one!

There are several ways to discover the EPSG code for a particular projection:

  • As described above, use the web: Online spatial reference search
  • Use R (rgdal package) # R code: library(rgdal) EPSG <- make_EPSG() # As an example, search for Hawaii state projections EPSG[grep("hawaii", EPSG$note, ignore.case=TRUE), 1:2] # Get PROJ.4 information for a particular EPSG code subset(EPSG, code==2784)

PROJ.4 strings

PROJ.4 strings are a quirky looking but compact way to identify a spatial reference system. Using the PROJ.4 syntax, it is possible to specify the complete set of parameters that define a particular SRS. As an example, here is the PROJ.4 string for the same Hawaii SRS shown above:

+proj=tmerc +lat_0=21.16666666666667 +lon_0=-158 +k=0.99999 \
+x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs

There are several ways to discover the PROJ.4 string for a particular spatial reference system:

  • As described above, use the web: Online spatial reference search
  • Given a particular EPSG code, you can extract the associated PROJ.4 string in R. This can be useful when the best you can do is find an EPSG code for a similar SRS, which you then need to tweak by modifying a part of the PROJ.4 string (see below for more details): # R code: library(rgdal) EPSG <- make_EPSG() # As an example, search for Hawaii state projections EPSG[grep("hawaii", EPSG$note, ignore.case=TRUE), 1:2] # Get PROJ.4 information for a particular EPSG code subset(EPSG, code==2784)

For highly customized projections, it may be necessary to construct the PROJ.4 string manually, perhaps using information obtained from a metadata document. The PROJ.4 string is a sequence of parameters, each one beginning with a + symbol. The mandatory +proj parameter gives the general projection using a PROJ.4-specific name (note: for unprojected data, use +proj=latlon). If a standard ellipsoid (+ellps) is used, it can be given by name, as can the datum (+datum). There are several ways to obtain a listing of the accepted names for each of these parameters:

  • Use the proj command line tool. When entered in a terminal window (OS X, Linux) or at the DOS Command Prompt (Windows) on a computer that has PROJ.4 installed, the three commands below will produce a list of all available named projections, ellipsoids, and datums, respectively:
    proj -lp
    proj -le
    proj -ld
  • Alternatively, in R you can use the rgdal package to do the same thing: # R code: library(rgdal) projInfo("proj") # projections projInfo("ellps") # ellipsoids projInfo("datum") # datums

You will then need to add any additional parameters (and their values) required to define the specific projection. For many common projections, refer to this online documentation of the relevant parameters. More generally, the PROJ.4 string will be built from a small set of parameters common to most/all projections. You can also find out if a given projection uses any non-standard PROJ.4 parameters by using the command line statement proj -l=<name>, where <name> is the PROJ.4 projection name. Of course, for all of these parameters, it will be up to you to specify the appropriate values!

Well-known text (WKT) format

WKT formats tend to be the easiest to read and understand, and consequently this is the format that many software tools use when displaying the spatial reference system for a given dataset. Probably for the same reason, it is common exchange format bundled with spatial data files. For example, the .prj files associated with shapefiles produced by ArcGIS use an ESRI-flavored WKT format. Here is a WKT example:

PROJCS["NAD83(HARN) / Hawaii zone 3",
            SPHEROID["GRS 1980",6378137,298.257222101,

While you can glean much information when scanning it by eye, this verbose format is probably the least desirable to write down by hand or even copy-and-paste, so specifying the EPSG code or PROJ.4 string should be preferred in cases where one or both of those formats will do. Otherwise, the Spatial Reference site will again be your best bet, or possibly copy the .prj file from a shapefile that you know uses the SRS you desire.

Learning More:

  • List of common PROJ.4 projections and their options
  • PROJ.4 wiki page documenting the general PROJ.4 parameters available for defining (most) coordinate systems
  • Flex Projector, a free, cross-platform Java application that provides a graphical interface for manipulating map projections. Designed primarily to enable users to create arbitrary new projections for custom map visualizations, this tool can be quite educational for those who simply want to get a sense of how and why projections differ.