ST_IsCollection

更新时间:
复制 MD 格式

Tests whether a geometry is a collection type. Returns true if the geometry type is one of:

  • GeometryCollection

  • MULTI{POINT, POLYGON, LINESTRING, CURVE, SURFACE}

  • MultiCompoundCurve

Syntax

boolean ST_IsCollection(geometry g);

Parameters

ParameterDescription
gThe geometry object to test.

Usage notes

  • An empty GeometryCollection returns true.

  • Supports 3D geometries and preserves z coordinates.

  • Supports circular strings and curves.

Examples

Return `true` for a MULTI type:

SELECT ST_IsCollection('MULTIPOINT((1 0),(2 0))'::geometry);
 st_iscollection
-----------------
 t
(1 row)

Return `true` for a GeometryCollection:

SELECT ST_IsCollection('GeometryCollection(POINT(1 0),POLYGON((1 0,2 0, 0 2,1 0)))'::geometry);
 st_iscollection
-----------------
 t
(1 row)