Converts a geometry object into a GeometryCollection object, simplifying its Well-Known Binary (WKB) representation.
Syntax
geometry ST_ForceCollection(geometry geomA);Parameters
| Parameter | Description |
|---|---|
geomA | The geometry object to convert. |
Usage notes
Useful for simplifying the Well-Known Binary (WKB) representation.
Supports circular strings, curves, and polyhedral surfaces.
Supports 3D objects and preserves Z coordinates.
Examples
Convert a polygon to a GeometryCollection:
SELECT ST_AsText(ST_ForceCollection(ST_GeomFromText('POLYGON((1 1,2 1,2 2,1 2,1 1))')));Output:
st_astext
----------------------------------------------------
GEOMETRYCOLLECTION(POLYGON((1 1,2 1,2 2,1 2,1 1)))
(1 row)该文章对您有帮助吗?