-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Geo: Fixes indexing of linestrings that go around the globe #47471
Geo: Fixes indexing of linestrings that go around the globe #47471
Conversation
LINESTRING (0 0, 720 20) is now decomposed into 3 strings: multilinestring ( (0.0 0.0, 180.0 5.0), (-180.0 5.0, 180 15), (-180.0 15.0, 0 20) ) It also fixes issues with linestrings that intersect antimeridian more than 5 times. Fixes elastic#43837 Fixes elastic#43826
Pinging @elastic/es-analytics-geo (:Analytics/Geo) |
…ound-the-world-linestring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, left some comments that I hope will clear things up to uneducated readers
} | ||
return lines; | ||
} | ||
|
||
double calculateShift(double lon, int direction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is a very specific operation/definition of a normalized lon, maybe javadocs would be helpful here
lons[offset + i - 1] = intersection.getX(); | ||
lats[offset + i - 1] = intersection.getY(); | ||
|
||
double shift = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it difficult to keep this, calculateShift(..)
, and shift(..)
separate. would some more distinct naming help, or would that just make things more confusing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shift is used all over the place and it is the actual shift as opposed to the amount of shift getting calculated and stored. I have renamed the method shift into performShift() here, I will rename the rest of them as I go through the changes in the areas where they are used.
…ound-the-world-linestring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes indexing of linestrings that go around the globe.
LINESTRING (0 0, 720 20)
is now decomposed into 3 strings:It also fixes issues with linestrings that intersect antimeridian
more than 5 times and adds optimization of decomposition
by -180 and 180 degrees at the same time.
Fixes #43837
Fixes #43826