This topic describes the ST_BdPolyFromText function. This function constructs a polygon object by using one or more closed linestrings that are represented by a Well-Known Text (WKT) string.
Syntax
geometry ST_BdPolyFromText(text WKT , integer srid);
Parameters
Parameter | Description |
---|---|
WKT | The WKT string that you want to specify. |
srid | The spatial reference identifier (SRID) of the polygon object. |
Description
- If the WKT string that you specify does not represent a MultiLineString object, this function returns an error.
- If this function obtains a MultiPolygon object by using the WKT string that you specify, this function returns an error. In this case, use the method that is used in the ST_BdMPolyFromText function or the ST_BuildArea function to specify the WKT string.
Examples
Construct a WKT string that represents a MultiLineString object and convert the WKT
string into a polygon object.
SELECT st_AsText(ST_BdPolyFromText(ST_AsText(ST_GeomFromText('MultiLineString((1 1,1 2),(2 2,1 1),(1 2,2 2))')),4326));
st_astext
----------------------------
POLYGON((1 1,1 2,2 2,1 1))
(1 row)