User's Guide and Reference

ST_SRID

ST_SRID takes a geometry object and returns its spatial reference system identity.

Syntax

db2gse.ST_SRID(g1 db2gse.ST_Geometry)

Return type

Integer

Examples

During the installation of the DB2 Spatial Extender the SPATIAL_REFERENCES table is created. When a geometry is created, the SRID of that geometry is entered into the SPATIAL_REFERENCES table. The ST_SRID function returns the value of that entry.

For example, a geometry type is used in a CREATE TABLE statement:

CREATE TABLE SRID_TEST(g1 db2gse.ST_Geometry) 

In the following INSERT statement, a point geometry located at coordinate 10.01,50.76 is inserted into the geometry column G1. When the point geometry was created by the ST_PointFromText function, it was assigned the srid value of 1.

INSERT INTO SRID_TEST
VALUES (db2gse.ST_PointFromText('point(10.01 50.76)', db2gse.coordref()..srid(0))) 

The ST_SRID function returns the spatial reference system identity of the geometry just entered, as illustrated by the following SELECT statement and the corresponding result set.

SELECT db2gse.ST_SRID(g1) FROM SRID_TEST
 
g1
--------------
1 


[ Top of Page | Previous Page | Next Page ]