📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

ST_MAKEPOLYGON



Constructs a GEOMETRY or GEOGRAPHY object that represents a Polygon without holes. The function uses the specified LineString as the outer loop.

Syntax

ST_MAKEPOLYGON(<geometry_or_geography>)

Aliases

Arguments

ArgumentsDescription
<geometry_or_geography>The argument must be an expression of type GEOMETRY or GEOGRAPHY.

Return Type

Geometry.

Examples

GEOMETRY examples

SELECT ST_MAKEPOLYGON( ST_GEOMETRYFROMWKT( 'LINESTRING(0.0 0.0, 1.0 0.0, 1.0 2.0, 0.0 2.0, 0.0 0.0)' ) ) AS pipeline_polygon; ┌────────────────────────────────┐ │ pipeline_polygon │ ├────────────────────────────────┤ │ POLYGON((0 0,1 0,1 2,0 2,0 0)) │ └────────────────────────────────┘

GEOGRAPHY examples

SELECT ST_MAKEPOLYGON( ST_GEOGFROMWKT( 'LINESTRING(0.0 0.0, 1.0 0.0, 1.0 2.0, 0.0 2.0, 0.0 0.0)' ) ) AS pipeline_polygon; ╭────────────────────────────────╮ │ pipeline_polygon │ ├────────────────────────────────┤ │ POLYGON((0 0,1 0,1 2,0 2,0 0)) │ ╰────────────────────────────────╯

Was this page helpful?