liveBook · Manning

Spatial reference system identifier

As explained in Just Use Postgres!

A spatial reference system identifier, or SRID, is a numeric code identifying the coordinate reference system associated with spatial data.

An SRID is a numeric code identifying the coordinate reference system associated with spatial data. In PostGIS, it determines how coordinates are interpreted and which units spatial calculations use. SRID 3857 identifies Web Mercator, commonly used by OpenStreetMap and Google Maps, where geometry calculations use meters. section 10.1.2

Use SRIDs consistently when creating, transforming, and measuring geometries:

  • Use ST_SetSRID to assign reference-system metadata; it does not transform coordinates. section 10.5.1
  • Use ST_Transform to convert coordinates between systems, such as from Web Mercator 3857 to WGS 84 latitude and longitude 4326. section 10.5.1
  • Remember that distance and area units follow the geometry’s spatial reference system. section 10.3.3

Creating a point with SRID 3857

For coordinates already expressed in Web Mercator, assign the correct SRID when constructing a point: ST_SetSRID(ST_MakePoint(-9178356.224987695, 3242002.0503882724), 3857). This lets ST_DWithin and ST_Distance compare the point with nearby restaurant geometries and report distances in meters.

How Just Use Postgres! covers it

How deep it goes
Explains geometry and geography SRIDs, units, assignment, and transformation, without developing coordinate-system theory.
Examples
Uses Tampa coordinate transformation, Web Mercator table definitions, and restaurant-distance queries built from assigned point coordinates.
What you can do after
Apply it via PostGIS to declare spatial columns, assign coordinate metadata, transform coordinates, and interpret measurement units.
How it connects
Connects spatial reference systems with geometry, geography, Web Mercator, WGS 84, ST_SetSRID, and ST_Transform.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.