Skip to content

ST_POLYGON

Creates a GEOGRAPHY polygon from the given LineString.

See also:

Syntax

sql
ST_POLYGON(<linestring>)

Arguments

  • <linestring>: A GEOGRAPHY object representing a closed LineString that forms the boundary of the polygon

Returns

Returns a GEOGRAPHY object of subtype ST_Polygon constructed from the input LineString.

Example

sql
SELECT ST_AsText(ST_POLYGON('LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)'::GEOGRAPHY));
-- POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))