postgis_srs_search
What is postgis_srs_search?
postgis_srs_search returns SRS metadata rows whose area-of-use intersects a supplied bounds geometry, optionally filtered by authority. Available from PostGIS 3.4.
postgis_srs_search(bounds geometry, auth_name text = 'EPSG') → SETOF recordThe bounds argument is typically a geometry in WGS84 representing the region of interest. The function returns every SRS whose declared area of use covers that region.
When would you use postgis_srs_search?
Use postgis_srs_search to find appropriate CRSs for a specific region — for instance, given a lat/lon bounding box of a project area, discover the local UTM zone, national grid, or state plane CRS that best suits it. It is especially useful in cartographic automation where the target CRS should vary by data location.
In QA pipelines, search-based CRS selection helps flag rows assigned an SRID whose area of use does not actually cover the feature's location.
FAQs
What coordinate system should the bounds use?
Typically WGS84 (EPSG:4326), since PROJ stores area-of-use bounds as lat/lon. Transform first if working in a different CRS.
Does it rank results by fit?
No — all CRSs whose bounds intersect the query are returned. Rank by bounding-box overlap or area yourself if needed.
Can I filter by authority?
Yes, via the auth_name argument. Default 'EPSG'. Pass 'ESRI' for ESRI-authored CRSs.
Which version introduced it?
PostGIS 3.4.