Skip to content

GeoPolygonDecomposer might fail due to numerical errors when calculating intersection with the dateline#82953

Merged
iverase merged 2 commits intoelastic:masterfrom
iverase:issueIssue82840
Jan 25, 2022
Merged

GeoPolygonDecomposer might fail due to numerical errors when calculating intersection with the dateline#82953
iverase merged 2 commits intoelastic:masterfrom
iverase:issueIssue82840

Conversation

@iverase
Copy link
Copy Markdown
Contributor

@iverase iverase commented Jan 24, 2022

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

@iverase iverase added >bug :Analytics/Geo Indexing, search aggregations of geo points and shapes v8.0.0 v8.1.0 v7.17.1 labels Jan 24, 2022
@iverase iverase requested a review from imotov January 24, 2022 15:43
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 24, 2022
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

Copy link
Copy Markdown
Contributor

@imotov imotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iverase iverase merged commit 3f723a4 into elastic:master Jan 25, 2022
@iverase iverase deleted the issueIssue82840 branch January 25, 2022 06:23
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

💔 Backport failed

Status Branch Result
8.0 Commit could not be cherrypicked due to conflicts
7.17 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 82953

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 that referenced this pull request Jan 25, 2022
…ing intersection with the dateline (#82953) (#83012)

This change make sure that our intersection point lies either +180 or -180 always.
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.
iverase added a commit that referenced this pull request Jan 25, 2022
…ing intersection with the dateline (#82953) (#83013)

This change make sure that our intersection point lies either +180 or -180 always.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.17.0 v8.0.0-rc2 v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] LatLonShapeDocValuesQueryTests testIndexSimpleShapes failing

6 participants