ST_GeometryType function
The ST_GeometryType function takes a geometry as input parameter and returns the fully qualified type name of the dynamic type of that geometry.
The functions TYPE_SCHEMA and TYPE_NAME have the same effect.
Syntax
Parameter
- geometry
- A value of type ST_Geometry for which the geometry type is to be returned.
Return type
VARCHAR(128)
Examples
The following code illustrates
how to determine the type of a geometry.
CREATE TABLE sample_geometries (id INTEGER, geometry ST_GEOMETRY)
INSERT INTO sample_geometries(id, geometry)
VALUES
(7101, ST_Geometry('point(1 2)', 1) ),
(7102, ST_Geometry('linestring(33 2, 34 3, 35 6)', 1) ),
(7103, ST_Geometry('polygon((3 3, 4 6, 5 3, 3 3))', 1)),
(7104, ST_Geometry('multipoint(1 2, 4 3)', 1) )
SELECT id, ST_GeometryType(geometry) AS geometry_type
FROM sample_geometries
Results:
ID GEOMETRY_TYPE
----------- -------------------------------
7101 SYSIBM.ST_POINT
7102 SYSIBM.ST_LINESTRING
7103 SYSIBM.ST_POLYGON
7104 SYSIBM.ST_MULTIPOINT
