ST_CoordDim returns the coordinate dimensions of the ST_Geometry value. For an explanation of coordinate dimensions, see Points.
Syntax
db2gse.ST_CoordDim(g1 db2gse.ST_Geometry)
Return type
Integer
Examples
The coorddim_test table is created with the columns geotype and g1. The geotype column stores the name of the geometry subclass stored in the g1 geometry column.
CREATE TABLE coorddim_test (geotype varchar(20), g1 db2gse.ST_Geometry)
The INSERT statements insert a sample subclass into the coorddim_test table.
INSERT INTO coorddim_test VALUES( 'Point', db2gse.ST_PointFromText('point (10.02 20.01)', db2gse.coordref()..srid(0)) ) INSERT INTO coorddim_test VALUES( 'Linestring', db2gse.ST_LineFromText('linestring (10.02 20.01,10.32 23.98,11.92 25.64)', db2gse.coordref()..srid(0)) ) INSERT INTO coorddim_test VALUES( 'Polygon', db2gse.ST_PolyFromText('polygon ((10.02 20.01,11.92 35.64,25.02 34.15, 19.15 33.94,10.02 20.01))', db2gse.coordref()..srid(0)) ) INSERT INTO coorddim_test VALUES( 'Multipoint', db2gse.ST_MPointFromText('multipoint (10.02 20.01,10.32 23.98, 11.92 25.64)', db2gse.coordref()..srid(0)) ) INSERT INTO coorddim_test VALUES( 'Multilinestring', db2gse.ST_MLineFromText('multilinestring ((10.02 20.01, 10.32 23.98,11.92 25.64),(9.55 23.75,15.36 30.11))', db2gse.coordref()..srid(0)) ) INSERT INTO coorddim_test VALUES( 'Multipolygon', MPolyFromText('multipolygon (((10.02 20.01,11.92 35.64,25.02 34.15, 19.15 33.94,10.02 20.01)),((51.71 21.73,73.36 27.04,71.52 32.87, 52.43 31.90,51.71 21.73)))', db2gse.coordref()..srid(0)) )
The SELECT statement lists the subclass name stored in the geotype column with the coordinate dimension of that geotype.
SELECT geotype, db2gse.ST_coordDim(g1)' coordinate_dimension' FROM coorddim_test GEOTYPE coordinate_dimension -------------------- -------------------------- ST_Point 2 ST_Linestring 2 ST_Polygon 2 ST_Multipoint 2 ST_Multilinestring 2 ST_Multipolygon 2 6 record(s) selected.