Tests if a geometry is a geometry collection type.
Syntax
boolean ST_IsCollection(geometry g);Parameters
| Parameter | Description |
|---|---|
g | The geometry object to test. |
Description
ST_IsCollection returns true for the following geometry types:
GeometryCollectionMultiPointMultiLineStringMultiCurveMultiSurfaceMultiCompoundCurvePolygon
This function checks the geometry type, not its contents. It returns true for empty collections.Additional behavior:
Supports 3D geometries and preserves Z coordinates.
Supports circular strings and curves.
Examples
MULTIPOINT (returns `true`)
SELECT ST_IsCollection('MULTIPOINT((1 0),(2 0))'::geometry);
st_iscollection
-----------------
t
(1 row)GeometryCollection (returns `true`)
SELECT ST_IsCollection('GeometryCollection(POINT(1 0),POLYGON((1 0,2 0, 0 2,1 0)))'::geometry);
st_iscollection
-----------------
t
(1 row)该文章对您有帮助吗?