PostGISSpatial Reference System

postgis_srs

What is postgis_srs?

postgis_srs looks up a single SRS in PROJ's database and returns a row of metadata including authority, code, name, type, deprecated flag, area of use, and bounds. Available from PostGIS 3.4.

SQL
postgis_srs(auth_name text, auth_code text) → record

Provides richer information than the raw spatial_ref_sys.srtext field, including PROJ's area-of-use geometry.

When would you use postgis_srs?

Use postgis_srs to validate a CRS choice against its official area of use — avoiding, for instance, the pitfall of using a local UTM zone CRS far outside its intended area. It is also useful in CRS-picker UIs that display human-readable names and validity bounds.

When building data-quality dashboards, postgis_srs helps flag rows whose bounding box falls outside the area of use of their declared SRID.

FAQs

What fields does it return?

Typically auth_name, auth_code, srname, srtype, srtext, proj4text, point_sw, point_ne, deprecated. Exact fields may vary by PostGIS version.

Is it cheaper than querying spatial_ref_sys?

Not necessarily — both lookups are indexable. The benefit of postgis_srs is that it queries PROJ's live metadata rather than the static table, which may be out of date.

What happens for unknown codes?

Returns no row. Handle with LATERAL or COALESCE in downstream queries.

What version introduced postgis_srs?

PostGIS 3.4.