Returns true if the exterior rings of the input polygon are oriented counterclockwise and the interior rings are oriented clockwise.
Syntax
boolean ST_IsPolygonCCW(geometry geom);Parameters
| Parameter | Description |
|---|---|
geom | The geometry object to check. |
Usage notes
If the input contains no polygon component, the function returns
true. A closed linestring is not considered a polygon component.If one or more interior rings and the exterior rings are oriented in the same direction, both
ST_IsPolygonCCWand ST_IsPolygonCW returnfalse.Supports 3D geometries and preserves Z coordinates.
Supports M coordinates.
Examples
Check whether a polygon's exterior ring is oriented counterclockwise and its interior ring is oriented clockwise:
SELECT ST_IsPolygonCCW('POLYGON((1 0,3 0,0 3,1 0),(1 0,0 2,2 0,1 0))'::geometry);Output:
st_ispolygonccw
-----------------
t
(1 row)The result t (true) indicates that the exterior ring is counterclockwise and the interior ring is clockwise.
该文章对您有帮助吗?