ST_SRID
The ST_SRID function takes a geometry as the input parameter and returns the spatial reference system identifier from the geometry.
If the given geometry is null, then null is returned.
Syntax
Parameters
- geometry
- A value of one of the seven distinct spatial data types that represents the geometry for which the spatial reference system identifier is to be set or returned.
Return types
INTEGER
Example
In the following example, two points
are created in two different spatial reference systems. You can use
the ST_SRID function to find the ID of the spatial reference system
that is associated with each point.
SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
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_SRID (geometry) SRID FROM sample_points
Results:
ID SRID
------ ---------
1 0
2 1