ST_GeometryType
Determines the class of a spatial object.
Behavior Type
Syntax
ST_GeometryType( g )
Arguments
g |
Spatial object for which you want the class, type GEOMETRY or GEOGRAPHY |
Returns
VARCHAR
Supported Data Types
Data Type | GEOMETRY | GEOGRAPHY (Perfect Sphere) |
Point | Yes | Yes |
Multipoint | Yes | Yes |
Linestring | Yes | Yes |
Multilinestring | Yes | Yes |
Polygon | Yes | Yes |
Multipolygon | Yes | Yes |
GeometryCollection | Yes | No |
Example
The following example shows how to use ST_GeometryType.
Returns spatial class:
=> SELECT ST_GeometryType(ST_GeomFromText('GEOMETRYCOLLECTION(LINESTRING(1 1, 2 2), POLYGON((1 3,4 5,2 2,1 3)))')); ST_GeometryType ----------------------- ST_GeometryCollection (1 row)