Name

ST_BdPolyFromText — Construct a Polygon given an arbitrary collection of closed linestrings as a MultiLineString text representation.

Synopsis

geometry ST_BdPolyFromText(varchar WKT, integer SRID);

Alias

BdPolyFromText

Description

Returns an ST_Polygon value, which is built from a well-known text representation of an ST_MultiLineString.

If the incoming geometry is not a MULTILINESTRING throws an error.

If the Multilinestring is not closed, returns NULL.

The result can be POLYGON or MULTIPOLYGON.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006SQL-MM Part 3
3.2.6.27.2.6-8.3.9

Examples

--Return the EWKT of the build polygon
SELECT ST_asewkt(ST_BdPolyFromText('MULTILINESTRING ((0 0, 0 150, 150 150, 150 0, 0 0), (20 20, 50 20, 50 50, 20 50, 20 20))', 23030));

--Result
SRID=23030;POLYGON ((0 150, 150 150, 150 0, 0 0, 0 150), (20 20, 50 20, 50 50, 20 50, 20 20))

--Not a closed MultiLineString
SELECT ST_asewkt(ST_BdPolyFromText('MULTILINESTRING ((0 0, 0 150, 150 150, 150 0, 20 20))', -1));

--Result: NULL is returned
st_asewkt
-----------

(1 row)

Related functions

ST_BdMPolyFromText