Returns the type of a geometry object as an uppercase string, such as LINESTRING, POLYGON, or MULTIPOINT.
Syntax
text GeometryType(geometry geomA);Parameters
| Parameter | Description |
|---|---|
geomA | The geometry object to inspect. |
Usage notes
M coordinates: When the input geometry contains m coordinates, the return value uses the
PointMformat — for example,LINESTRINGM.Extended geometry types: The function supports circular strings, curves, polyhedral surfaces, triangles, triangulated irregular network (TIN) surfaces, and 3D objects.
Examples
Basic geometry type
SELECT GeometryType('LINESTRING(1 0, 2 0)'::geometry);
geometrytype
--------------
LINESTRING
(1 row)Geometry with m coordinates
When the geometry includes m coordinates, the function appends M to the type name.
SELECT GeometryType('LINESTRINGM(1 0 1, 2 0 2)'::geometry);
geometrytype
--------------
LINESTRINGM
(1 row)