This topic describes the ST_BdMPolyFromText function. This function constructs a MultiPolygon object by using one or more closed linestrings, polygons, or MultiLineStrings that are represented by a Well-Known Text (WKT) string.
Syntax
geometry ST_BdMPolyFromText(text WKT , integer srid);
Parameters
Parameter | Description |
---|---|
WKT | The WKT string that you want to specify. |
srid | The spatial reference identifier (SRID) of the MultiPolygon object. |
Description
- If the WKT string that you specify does not represent a MultiLineString object, this function returns an error.
- This function returns a MultiPolygon object even if you specify a single polygon.
Note If you want to construct a MultiPolygon object by using a single polygon, we recommend that you use the ST_BdPolyFromText function.
Examples
Construct a WKT string that represents a MultiLineString object and convert the WKT
string into a MultiPolygon object.
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 -1,-1 -2,-2 -2,-1 -1)),((1 1,1 2,2 2,1 1)))
(1 row)