ST_SrsName function
The ST_SrsName function takes a geometry as an input parameter and returns the name of the spatial reference system in which the given geometry is represented.
If the given geometry is null, then null is returned.
This function can also be called as a method.
Syntax
Parameter
- geometry
- A value of type ST_Geometry or one of its subtypes that represents the geometry for which the name of the spatial reference system is returned.
Return type
VARCHAR(128)
Example
Two points are created in different
spatial reference systems. The ST_SrsName function is used to find
out the name 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_SrsName (geometry) SRSNAME
FROM sample_points
Results:
ID SRSNAME
----------- ------------------------------
1 DEFAULT_SRS
2 NAD83_SRS_1