[PostGIS] #6139: ST_IsPolygonCW and ST_IsPolygonCCW both return true for CURVEPOLYGON

PostGIS trac at osgeo.org
Wed Sep 30 05:36:27 PDT 2026


#6139: ST_IsPolygonCW and ST_IsPolygonCCW both return true for CURVEPOLYGON
---------------------+---------------------
 Reporter:  nti      |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:
Component:  postgis  |    Version:  3.6.x
 Keywords:           |
---------------------+---------------------
 For a CURVEPOLYGON both ST_IsPolygonCW() and ST_IsPolygonCCW() return true
 for the same geometry.

 For example:

 {{{
 WITH g AS (
     SELECT 'CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 0, 5 5, 10 0),(10
 0, 10 10, 0 10, 0 0)))'::geometry AS geom
 )
 SELECT
     ST_IsPolygonCW(geom) AS is_cw,
     ST_IsPolygonCCW(geom) AS is_ccw
 FROM g;
 }}}

 Is this expected behavior for CURVEPOLYGON, or is this a bug/limitation in
 the handling of curved geometries?

 I am running into this issue in the context of using ST_ForcePolygonCCW on
 a generic geometry column which might contain some curvepolygons. Those
 geometries are always being reversed by ST_ForcePolygonCCW even though
 they are already CCW, as ST_IsPolygonCW will always return true.

 If it is indeed expected that both ST_IsPolygonCW/ST_IsPolygonCCW return
 true at the same time, then I would at least expect that
 ST_ForcePolygonCCW/ ST_ForcePolygonCW should return CURVEPOLYGON
 geometries unchanged.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/6139>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list