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

ST_MAKEPOLYGONORIENTED



Creates a Polygon from a LineString input, preserving the vertex order as given. Unlike ST_MAKEPOLYGON, this function does not reorder vertices to enforce a specific winding direction.

Syntax

ST_MAKEPOLYGONORIENTED(<geometry>)

Arguments

ArgumentsDescription
<geometry>A GEOMETRY expression of type LineString. Must have at least 4 points with the first and last point being identical.

Return Type

Geometry.

Examples

SELECT ST_ASWKT( ST_MAKEPOLYGONORIENTED(TO_GEOMETRY('LINESTRING(0 0, 1 0, 1 2, 0 2, 0 0)')) ); ┌──────────────────────────────────┐ │ result │ ├──────────────────────────────────┤ │ POLYGON((0 0,1 0,1 2,0 2,0 0)) │ └──────────────────────────────────┘ -- Reversed winding order is preserved SELECT ST_ASWKT( ST_MAKEPOLYGONORIENTED(TO_GEOMETRY('LINESTRING(0 0, 0 2, 1 2, 1 0, 0 0)')) ); ┌──────────────────────────────────┐ │ result │ ├──────────────────────────────────┤ │ POLYGON((0 0,0 2,1 2,1 0,0 0)) │ └──────────────────────────────────┘

Was this page helpful?