Constructs a MultiPolygon geometry from one or more closed LineStrings, Polygons, or MultiLineStrings represented as a Well-Known Text (WKT) string.
Syntax
geometry ST_BdMPolyFromText(text WKT, integer srid);Parameters
| Parameter | Description |
|---|---|
| WKT | The WKT string. |
| srid | The spatial reference identifier (SRID) of the MultiPolygon. |
Usage notes
If the WKT string does not represent a MultiLineString, the function returns an error.
The function returns a MultiPolygon, even when the input describes a single Polygon.
To construct a MultiPolygon from a single Polygon, use ST_BdPolyFromText instead.
Examples
Convert a WKT string representing a MultiLineString into a MultiPolygon.
SELECT st_AsText(ST_BdMPolyFromText('MultiLineString((1 1,1 2),(2 2,1 1),(1 2,2 2),(-1 -1,-1 -2),(-2 -2,-1 -1),(-1 -2,-2 -2))',4326));
st_astext
---------------------------------------------------------------
MULTIPOLYGON(((-1 -2,-2 -2,-1 -1,-1 -2)),((1 2,2 2,1 1,1 2)))
(1 row)该文章对您有帮助吗?