Returns the type of a geometry object as a text string, such as LINESTRING, POLYGON, or MULTIPOINT.
Syntax
text GeometryType(geometry geomA);Return type
text — the geometry type name in uppercase, for example, LINESTRING.
If the input geometry contains M coordinates, the function appends M to the type name, for example, LINESTRINGM.
Parameters
| Parameter | Description |
|---|---|
geomA | The geometry object to inspect. |
Supported geometry types
GeometryType supports the full range of PostGIS geometry types:
Circular strings and curves
Polyhedral surfaces
Triangles and triangulated irregular network (TIN) surfaces
3D objects
Examples
Standard geometry type
SELECT GeometryType('LINESTRING(1 0, 2 0)'::geometry);
geometrytype
--------------
LINESTRING
(1 row)Geometry with M coordinates
SELECT GeometryType('LINESTRINGM(1 0 1, 2 0 2)'::geometry);
geometrytype
--------------
LINESTRINGM
(1 row)该文章对您有帮助吗?