ST_IsPolygonCCW¶
Introduction: Returns true if all polygonal components in the input geometry have their exterior rings oriented counter-clockwise and interior rings oriented clockwise. Polygonal components nested inside a GEOMETRYCOLLECTION, at any depth, are recursively inspected. Non-polygonal components (points, line strings, etc.) are ignored.
An input with no polygonal components at all - points, line strings, and empty geometry collections included - vacuously returns true, since there is no ring to violate the requested orientation. This also covers POLYGON EMPTY and MULTIPOLYGON EMPTY. A SQL NULL input returns NULL.
Note
Starting with Sedona 2.0.0, ST_IsPolygonCCW matches PostGIS behavior for non-polygonal and GEOMETRYCOLLECTION inputs. Earlier versions returned false for such inputs instead of recursing into them; see the release notes for details.
Format: ST_IsPolygonCCW(geom: Geometry)
Return type: Boolean
SQL Example:
SELECT ST_IsPolygonCCW(ST_GeomFromWKT('POLYGON ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20))'))
Output:
true