petern48 commented on PR #2529:
URL: https://github.com/apache/sedona/pull/2529#issuecomment-3590761875
> Would it be acceptable to change our comparison from equals_exact to
equals for polygons, so that we check geometric equality rather than strict
vertex order? Or is there a recommended workaround for this situation, or
something I might be missing in our test setup?
The issue is not whether we're using `equals_exact()` or `equals()`. If you
give it a try, you'll see that the comparison fails either way. Despite the
name, equals_exact is actually more lenient, since it supports a tolerance
parameter.
<details>
<summary>Script to test using equals instead</summary>
```
import shapely
geom1 = shapely.wkt.loads("POLYGON ((1 4, 3 4, 4 4, 3 1, 4 0, 0 0, 1 1, 0 4,
1 4))")
geom2 = shapely.wkt.loads("POLYGON ((1 4, 3 4, 4 4, 4 0, 3 1, 0 0, 1 1, 0 4,
1 4))")
print(geom1.equals(geom2)) # False
print(geom1.equals_exact(geom2, 0.000001)) # False
```
</details>
<details>
<summary>Images to visualize the different results </summary>
<img width="639" height="182" alt="image"
src="https://github.com/user-attachments/assets/061a5266-56f4-4a8f-a247-c9ed9d9ba683"
/>
<img width="654" height="193" alt="image"
src="https://github.com/user-attachments/assets/e3591281-e3d3-48e2-8ad8-1c7ef1e52cde"
/>
</details>
As you can see above, these geometries actually are different. Why this is
happening, I'm not sure. It could either be a bug in Sedona's function or a
difference in algorithms or edge case behaviors. If it's a significant bug, we
may want to hold off. If it's a reasonable difference in behavior that's still
correct, we can add a note in the docs and merge this anyway. Either way, we
need to understand what's happening before merging. I encourage you to
investigate, though you're not obligated to, of course, and can continue with
something else instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]