-
Notifications
You must be signed in to change notification settings - Fork 6
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
Ensure polygons are inside -180/180 range before making stac request #734
Conversation
✅ Deploy Preview for veda-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
When I draw on the left-most or right-most out of four cycles of the Earth across the antimeridian, part of the geometry seems to be there but not visible: Drawn on left-most cycle: Drawn on right-most cycle: Actually, when I draw on the left-most or right-most map west respectively east of the antimeridian, the polygon seems to be present (analysis option becomes active), but the polygon is not shown on any of the maps. |
We earlier discussed whether we could just show only one cycle of the Earth. My concern then was, that this would make the map look weird. However, if this causes too much headache, could we perhaps show the whole map (with repetitions), but guide the user only draw within those cycles where we can do the normalization safely? |
@j08lue Addressed. |
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.
Awesome, great work handling all these over-the-edge cases... The guardrails keep me from running into the original issue now.
); | ||
|
||
// Or 1 in case the largestLng is exactly -180. | ||
const shift = Math.ceil(Math.abs((largestLng + 180) / 360)) || 1; |
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.
It will be an edge case, but 1 degree in Mercator doesn't seem to be that small number?
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.
This does not refer to 1º but to how many times to ship 360º. The result is that the coordinates move to the "repeated map" they are to the correct one (between -180/180)
coordinates: [ | ||
[ | ||
[ | ||
[-170, -20], |
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.
Can you point me where the order of the coordinates changes? I can't wrap my head around it.
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.
That was also strange to me, but for some reason the turf.js function (intersect and difference), reorder the coordinates when cutting the polygons.
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.
Yay test. (Test description can be more helpful! ) I left a concern about an edge case and a question about the order of the coordinates. 🤔 I wonder if there are better names than east
and west
for coordinates to go over >180, <-180 . Nothing seems to be a blocker
@hanbyul-here You're right. The messages were absolutely atrocious 😅. I made them more descriptive and will merge. Feel free to suggest further improvements. |
See #732
I created a script to cut the polygons that cross the antimeridian and them shift them inside the correct range.
Includes some unit tests for the function.