Fix NumPy 2.0 compatibility in simplify.py using 3D padding#2079
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the upper bound constraint on numpy in requirements.txt and updates the GeoJSON simplification script to pad 2D coordinates to 3D, avoiding NumPy 2.0+ errors in the rdp library. The reviewer suggests checking the coordinate dimensions first to ensure that existing 3D coordinates are not stripped of their altitude data.
ajaits
approved these changes
Jun 29, 2026
ajaits
left a comment
Contributor
There was a problem hiding this comment.
Thank you for the quick fix!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
rdplibrary callsnp.cross()on 2D vectors, which fails with aValueErrorin NumPy 2.0+. PR #2078 attempted to fix this by pinningnumpy<=2.0.0, but it caused pandas to segfault in the CI due to binary incompatibilities.As a workaround, I padded 2D coordinates to 3D ([x, y, 0.0]) before passing them to
rdp.rdp, and stripped them back to 2D afterwards. Sincenp.crossis supported for 3D vectors in NumPy 2.0+, this should fix the issue.I ran the failing tests locally to confirm that they're passing now.