ST_SrsId or ST_SRID function

The ST_SrsId or ST_SRID function takes a geometry as input parameters.

The current spatial reference system identifier of the specified geometry is returned. If the specified geometry is null, then null is returned.

Syntax

Read syntax diagramSkip visual syntax diagramST_SrsIdST_SRID(geometry )

Parameters

geometry
A value of type ST_Geometry or one of its subtypes that represents the geometry for which the spatial reference system identifier is to be set or returned.

Return type

INTEGER

Example

Two points are created in two different spatial reference systems. The ID of the spatial reference system that is associated with each point can be found by using the ST_SrsId function.

CREATE TABLE sample_points (id INTEGER, geometry ST_Point)

INSERT INTO sample_points
  VALUES (1, ST_Point( 'point (80 180)', 0 ) )
INSERT INTO sample_points
  VALUES (2, ST_Point( 'point (-74.21450127 + 42.03415094)', 1 ) )

SELECT id, ST_SRSId (geometry) SRSID
  FROM sample_points

Results:

ID           SRSID
----------- ------------
          1            0
          2            1