ST_MAKEPOLYGON()
All functions > GEOSPATIAL > ST_MAKEPOLYGON()
Creates a POLYGON from a closed LineString shell.
Signatures
Make polygon
Returns: A polygon with the given outer ring
ST_MAKEPOLYGON(shell: T) → GEOM_POLYGON or GEOG_POLYGON sql
| Parameter | Type | Required | Description |
|---|---|---|---|
shell | T | Yes | A closed LineString defining the outer ring |
With:
T: Custom types: GEOM_LINESTRING | GEOG_LINESTRING
Signature notes:
- The input LineString must be closed (first and last vertex identical); otherwise raises an error
- No interior rings (holes); for holes use ST_GEOMFROMTEXT with a POLYGON WKT
- Returns NULL if the input is NULL
- On Trino: transpiled to ST_Polygon
Examples
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_MAKEPOLYGON(ST_GEOMFROMTEXT('LINESTRING (0 0, 1 0, 1 1, 0 1, 0 0)'))) -- Polygon from a closed ring
;Result
| f1 VARCHAR |
|---|
| POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) |
On this page