ST_IsGeographicCRS

Signature

BOOLEAN ST_IsGeographicCRS(GEOMETRY geom);

Description

Takes a geometry (geom) and return TRUE is the coordinate system is geographic.

This function will return FALSE if:

  • the coordinate system is geometric,

  • the geometry is null,

  • the geometry’s SRID is equal to 0.

Tip

Find the SRID you’re looking for

All available CRS SRIDs may be found by executing the query SELECT * FROM SPATIAL_REF_SYS;. Most SRIDs are EPSG, but the SPATIAL_REF_SYS table may be enriched by other CRSes.

Examples

Case with no SRID

Here we have a POINT whose coordinates are exprimed in WGS84 - EPSG:4326, but no SRID is applied

SELECT ST_IsGeographicCRS('POINT(-1.53391 47.20259)');

-- Answer: FALSE

Case with a SRID

With the same POINT seen before, we force the SRID to be in WGS84 - EPSG:4326

SELECT ST_IsGeographicCRS(ST_SetSRID('POINT(-1.53391 47.20259)', 4326));

-- Answer: TRUE

Same POINT, but exprimed and forced in Lambert 93 (legal system in France - EPSG:2154), which is not a geographic system

SELECT ST_IsGeographicCRS(ST_SetSRID('POINT(356964.672 6687884.168)', 2154));

-- Answer: FALSE

See also