GeoPolygonDecomposer might fail due to numerical errors when calculating intersection with the dateline#82953
Merged
iverase merged 2 commits intoelastic:masterfrom Jan 25, 2022
Merged
Conversation
…ing intersection with the dateline
Collaborator
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
iverase
added a commit
to iverase/elasticsearch
that referenced
this pull request
Jan 25, 2022
…ing intersection with the dateline (elastic#82953) This change make sure that our intersection point lies either +180 or -180 always. # Conflicts: # server/src/test/java/org/elasticsearch/common/geo/GeometryNormalizerTests.java
iverase
added a commit
to iverase/elasticsearch
that referenced
this pull request
Jan 25, 2022
…ing intersection with the dateline (elastic#82953) This change make sure that our intersection point lies either +180 or -180 always.
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.
In order to break a polygon around the dateline we compute the point where it crosses such line. We use basic cartesian mathematics. First we compute the position of the crossing on the line between the two points at each side of the dateline, then we use the equation of the line to compute the exact coordinate.
In this computation the longitude coordinate should always be equals to the dateline ( +180 or -180) but it might happen that for numerical errors it is not exactly that number. This makes the logic fails downstream as we compare that coordinate to either +180 or -180.
This change make sure that our intersection point contains either +180 or -180 always.
fixes #82840