User's Guide and Reference

ST_GeometryType

ST_GeometryType takes a ST_Geometry object and returns its geometry type as a string.

Syntax

db2gse.ST_GeometryType (g db2gse.ST_Geometry)

Return type

Varchar(4000)

Examples

The GEOMETRYTYPE_TEST table contains the G1 geometry column.

CREATE TABLE GEOMETRYTYPE_TEST(g1 db2gse.ST_Geometry)

The following INSERT statements insert each geometry subclass into the G1 column.

INSERT INTO GEOMETRYTYPE_TEST
VALUES(db2gse.ST_GeometryFromText('point (10.02 20.01)', db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRYTYPE_TEST
VALUES (db2gse.ST_GeometryFromText('linestring (10.01 20.01, 10.01 30.01, 10.01 40.01)',
                         db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRYTYPE_TEST 
VALUES(db2gse.ST_Geometrytype_test values(db2gse.ST_GeomFromText('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 GEOMETRYTYPE_TEST
VALUES(db2gse.ST_GeometryFromText('multipoint (10.02
 20.01,10.32 23.98,11.92 25.64)',
                        db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRYTYPE_TEST
VALUES(db2gse.ST_GeometryFromText('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 GEOMETRYTYPE_TEST
VALUES(db2gse.ST_GeometryFromText('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 following SELECT statement lists the geometry type of each subclass that is stored in the G1 geometry column.

SELECT db2gse.ST_GeometryType(g1) "Geometry type" FROM GEOMETRYTYPE_TEST 

The following result set is returned.

Geometry type
--------------------------------
ST_Point
ST_LineString
ST_Polygon
ST_MultiPoint
ST_MultiLineString
ST_MultiPolygon
 
  6 record(s) selected.


[ Top of Page | Previous Page | Next Page ]