Opened 3 years ago

Closed 3 years ago

#1099 closed defect (fixed)

Polygon compareToSameClass does not account for holes

Reported by: Brendan Ward Owned by: geos-devel@…
Priority: major Milestone: 3.10.0
Component: Default Version: 3.9.0
Severity: Unassigned Keywords:
Cc:

Description

This function returns true even if holes are different between polygons.

Only the outer shell is compared: https://github.com/libgeos/geos/blob/3.9/src/geom/Polygon.cpp#L329-L333

This looks like it is also the same case in JTS: https://github.com/locationtech/jts/blob/jts-1.18.0/modules/core/src/main/java/org/locationtech/jts/geom/Polygon.java#L369-L396

(only the second variant compares holes)

Looks like the fix here is to use a similar approach as the second function above in GEOS. Working up a PR per that approach now.

Change History (3)

comment:1 by mdavis, 3 years ago

Dang, that's a bit egregious. Definitely needs to be fixed.

comment:2 by mdavis, 3 years ago

Fixed in JTS by PR 678

comment:3 by Brendan Ward, 3 years ago

Milestone: 3.9.13.10.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.