Nome

ST_Polygon — Creates a Polygon from a LineString with a specified SRID.

Sinossi

geometry ST_Polygon(geometry lineString, integer srid);

Descrizione

Returns a polygon built from the given LineString and sets the spatial reference system from the srid.

ST_Polygon is similar to ST_MakePolygon Variant 1 with the addition of setting the SRID.

, ST_MakePoint, ST_SetSRID

[Nota]

This function does not accept MultiLineStrings. Use ST_LineMerge to generate a LineString, or ST_Dump to extract LineStrings.

Questo metodo implementa le OGC Simple Features Implementation Specification for SQL 1.1.

Questo metodo implementa la specifica SQL/MM. SQL-MM 3: 8.3.2

Questa funzione supporta il 3d e non distrugge gli z-index.

Esempi

Create a 2D polygon.

Code
SELECT ST_Polygon('LINESTRING(75 29,77 29,77 31,75 31,75 29)'::geometry, 4326);
Output
POLYGON((75 29,77 29,77 31,75 31,75 29))
Figure
Geometry figure for visual-st-polygon-01

Create a 3D polygon.

Code
SELECT ST_Polygon('LINESTRING(75 29 1,77 29 2,77 31 2,75 31 1,75 29 1)'::geometry, 4326);
Output
SRID=4326;POLYGON((75 29 1,77 29 2,77 31 2,75 31 1,75 29 1))
Figure
Geometry figure for visual-st-polygon-02