Skip to main content
POLYGON constructors use geospatial data to create a POLYGON object.

ST_FORCECCW

Creates a standardized polygon from an existing one. defines standardized as the exterior being counterclockwise (CCW) and all holes being clockwise (CW) oriented. Syntax
SQL
Example
SQL
Output: POLYGON((0 0,1 0,1 1,0 1,0 0))

ST_MAKEPOLYGON

Alias for ST_POLYGON.

ST_POLYGON

Creates a POLYGON.

ST_POLYGON(geo)

Creates a POLYGON from the specified POINT, POINT array, LINESTRING, or POLYGON geography. Syntax
SQL
Example
SQL
Output: POLYGON((1 2,1 3,1 4,1 2))

ST_POLYGON(char) [#st_polygon-char]

Alias for ST_MAKEPOLYGON(char). Creates a POLYGON from the specified CHAR representing a POLYGON in WKT format. Syntax
SQL
Example
SQL
Output: POLYGON((1 2,1 3,1 4,1 2))

ST_POLYGON(binary) [#st_polygon-binary]

Alias for ST_POLYGONFROMWKB(binary). Creates a POLYGON from the specified BINARY. The BINARY value must represent a POLYGON in WKB format. Syntax
SQL
Example
SQL
Output: POLYGON((0 0,0 1,1 1,1 0,0 0))

ST_POLYGON(outer_ring, inner_rings)

Alias for ST_MAKEPOLYGON(outerRing, innerRings). Creates a POLYGON from the specified outer ring (that must be either a POINT, POINT array, or LINESTRING) and the array of interior rings (closed lines). The interior of the POLYGON is on the left when traveling around the exterior ring. The interior of a hole is on the right when traveling around a hole. Syntax
SQL
Example
SQL
OutputPOLYGON((1.000000 2.000000), (1.000000 2.000000))

ST_POLYGONFROMWKB

Alias for ST_POLYGON(binary).

ST_POLYGONFROMEWKT

Alias for the ST_POLYGON constructor. Creates a POLYGON using an EWKT-formatted CHAR as an input argument. Syntax
SQL
Example
SQL
OutputPOLYGON((1 2,1 3,1 4,1 2))

ST_POLYGONFROMGEOJSON

Creates a POLYGON represented by the specified GeoJSON value as an input argument. Syntax
SQL
Examples In this example, the function produces an empty POLYGON value from the GeoJSON representation.
SQL
Output: POLYGON EMPTY In this example, the function produces a POLYGON value from the GeoJSON representation.
SQL
Output: POLYGON((1 1, 1 5, 5 5, 5 1))

ST_POLYGONFROMTEXT

Alias for ST_POLYGON(char).

ST_WHOLEEARTH

Returns the database internal representation of the whole earth polygon. The ST_ENVELOPE function returns this POLYGON value, with the envelope set as the entire earth. GIS specifications do not describe a canonical polygon for the whole earth, but this value serves as the Ocient-canonical polygon. The whole earth polygon is also equivalent to ST_POLYGON('POLYGON((0 0,0 0,0 0,0 0'))), which can have a separate meaning in other GIS implementations. Syntax
SQL
Example
SQL
OutputPOLYGON((0.0 0.0, 0.0 0.0, 0.0 0.0, 0.0 0.0)) Geospatial Data Types Conversion Functions
Last modified on May 20, 2026