ST_Polygon — Creates a Polygon from a closed LineString and SRID.
geometry ST_Polygon(
varchar
LineString, integer
SRID)
;
Creates a Polygon from a closed LineString given the Spatial Reference System ID (SRID).
If the incoming object is not a LineString or it is not closed throws an error.
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 |
---|---|---|---|
- | - | - | 8.3.2 |
--Return SELECT ST_Asewkt(ST_Polygon(ST_GeomFromText('LINESTRING (0 0, 0 150, 150 150, 150 0, 0 0)'),-1)); --Result POLYGON ((0 0, 0 150, 150 150, 150 0, 0 0)) --Not a closed LineString SELECT ST_Asewkt(ST_Polygon(ST_GeomFromText('LINESTRING (0 0, 0 150, 150 0, 15 0)'),-1)); --Result, throws an error ERROR: java.lang.IllegalArgumentException: Points of LinearRing do not form a closed linestring