Fix geojson EllipsoidRhumbLine
error for duplicated points
#12460
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.
Description
Sometimes polygons have duplicated points in their definition. This causes the code we have to subdivide the lines for the
EllipsoidRhumbLine
arc type to fail. Even if it's not ideal the duplicated points shouldn't cause our render to crash, especially when other applications likegeojson.io
render correctly and validators show nothing wrong with the GeoJSON.Note: I'm not 100% confident this fix is done at the right "level" of the code. I was also able to get the failing examples working by removing the error call itself. That said I think it's a valid error if you're using that class directly but in this instance for polygons we simply don't care and can short circuit the function before we even try the code that "fails".
For context I encountered this during work on #12456 with one of the example sources
Issue number and link
Fixes #7864
Testing plan
main
and this branch and check that this branch does not crash outAuthor checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change