### What is a Spatial Reference Identifier (SRID)?

SRID identifies the **coordinate system** of the data: it tells us **how the data represent locations on the earth.**

Roughly, a coordinate system contains:

- Units to attach to the numbers in the data
- Frame of reference (where is zero and what directions are the units pointing)

An analogy:

- Our data is "15"
- Our coordinate system is:
- units: "seconds"
- frame of reference: "seconds after midnight"

You can see how applying "minutes" instead of "seconds", or "before 9AM" instead of "after midnight" would change the meaning of the data!

An analogy:

- Your number 10 is in base ‘10’
- Your number “00110001 00110000 0001010” is in base ‘2’
- In order for you to perform the operation, (10 + ‘00110001 00110000 0001010’) and get the kind of result that is meaningful, you have to convert the two numbers into the same ‘base’ before performing any operation between them.

### How does PostGIS use SRIDs?

PostGIS expects all the data in any given query to be using the same coordinate system (i.e. to have the same SRID). In order for spatial queries to work, spatial objects must represented in the same coordinate system.

In order to unify data, PostGIS supports arbitrary transformations of datasets between coordinate systems, but it needs to know what the source & target coordinate systems are for the transformation. **PostGIS uses the coordinate system specified by the SRID attached to each dataset.**

Even though the output will be nonsensical, PostGIS does not require all data to have a coordinate system, or for two datasets in the same query to have the same one. PostGIS will report a warning but will not prevent such operations.

It is a best practice to avoid these warnings: **always specify a coordinate system** for all spatial datasets when they are imported, and use transformations to **convert data into the same coordinate system before running queries** against multiple datasets.

### What different coordinate systems exist?

Many! This index of coordinate systems (which does have some test systems and duplicates) has 9,756 entries. However, in practice there are only a handful of coordinate systems that are commonly used for global-scale data, and only a few coordinate systems that are useful for each region of the earth at a specific scale (e.g. Greenland, or the City of Boston).

**Global coordinate systems** tend to agree on the system of units used: **latitude & longitude.** However, different global coordinate systems use different constants to define their frames of reference, or have different values for the same constants. These differences are *very small.*

For example, the most widely used (by far) global coordinate system is WGS84, which is used by all GPS technology. WGS84 and an earlier global coordinate system, NAD83, have different measurements for the distance from the center of the Earth to the North Pole. These measurements differ by one part in 60 billion.

**Local coordinate systems** may not use latitude & longitude as their units, have frames of reference that are specific to the local area where they are used, and often use a 2D projection of the earth rather than a true spheroidal model.

For example, the Massachusetts State Plane Coordinate System, used by the City of Boston, uses a Lambert conformal conic projection (LCC) with latitude & longitude for units, and a frame of reference which repositions the location of 0º, 0º.

As another example, Texas' Harris County has its own coordinate system, which is also projected into 2D using an LCC. The Harris County coordinate system has a distinct frame of reference specified by latitude & longitude, but uses *meters* on the X & Y axes for units.

Any two local coordinate systems chosen at random will have different frames of reference, and might have different units!

### Can we recommend an SRID to users in Shapefile Imports?

**As a best practice, no.** All geospatial data is created with using a specific coordinate system, and interpreting it using a different one will **always introduce errors**. An error of even 6 inches could lead to the misclassification of, e.g. whether a residence is eligible for flood insurance, since those boundaries have no tolerance-- you're either in or out.

In terms of helping users understand their data, **we can provide different suggestions depending on whether their data is using a global or local coordinate system. **The vast majority of datasets in a global coordinate system will be using WGS84 (SRID 4326), and if the user is not using the dataset to make critical binary decisions, the error introduced by incorrectly using this projection will probably be very small.

If the user's data uses a local coordinate system, they will need to provide the SRID themselves because we cannot make any recommendation. There are *many* local coordinate systems, and the error introduced by using the wrong one will almost always be massive.

## Comments

0 comments

Please sign in to leave a comment.