-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hausdorff distance wrong for LinearRing #987
Comments
This is because the case This is a common problem with checking typeIds rather than using the inheritance structure. No doubt there were good reasons for doing this. It's a simple fix here, of course. The bigger worry is whether there are other places in the code which need to check for |
Could do an audit to look for suspect patterns? The inheritance level checks had a big performance penalty, so they got scrubbed out a few releases ago. |
the "assume geom is Point" part probably should throw an exception if unhandled |
Yep, I've had a look. Actually looks pretty clea. There might be one or two other instances that need to be fixed - I will check further. |
Yes, good point. Like in |
LinearRings are the red-headed stepchild in JTS/GEOS - they are underrepresented in unit tests (and maybe in some algorithms). |
It seems when this component was ported from JTS' DistanceToPoint.java, |
Actually the port originally used the C++ equivalent of
But this was changed in bf2958e to use the hand-rolled typeId pattern. Apparently |
A more geometric-based alternative would be to check if the geometry is atomic (not a collection) and has dimension = 1. Or perhaps provide a There is 3 situations which can occur (and I think there's instances of all being used in different algorithms):
Instead of relying on the brittle |
Originally reported shapely/shapely#1934
Three geometry types with the same coordinates yield different Hausdorff distances, when the expected result should be the same (as JTS does).
Testing against main:
Here is a viz of the expected result via JTS:
The text was updated successfully, but these errors were encountered: