ST_BdPolyFromText — Construct a Polygon given an arbitrary collection of closed linestrings as a MultiLineString text representation.
geometry ST_BdPolyFromText(
varchar WKT, integer
SRID)
;
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.
2D | 3D | M |
---|---|---|
OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006 | SQL-MM Part 3 |
---|---|---|---|
3.2.6.2 | 7.2.6 | - | 8.3.9 |
--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)