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
Handle wrapped worlds in Box Selection example #14608
Conversation
📦 Preview the website for this branch here: https://deploy-preview-14608--ol-site.netlify.app/. |
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 example has a lot of complexity. Previously it was the rotation that made it complicated, now antimeridian handling is added. What if the API of ol/interaction/DragBox
had a getGeometries()
method, or the dragend
event had a geometries
property, where one geometry for each world is provided? Then this example would not get even more complicated. Later, this example could be further simplified by using turf for geometry level intersections, then nothing would have to be rotated.
That requirement is not specific to this example or DragBox. A method for converting wrapped geometries into normal world MultiPolygons or MultiLineStrings could be very useful elsewhere. #11681 (comment) has the algorithm for LineStrings, which would need to be adapted for LinearRings. It should also work with any global projection coordinates as splitting a long straight line in EPSG:4326 would produce a kink when displayed in EPSG:3857. |
@mike-000 Something like a A simple fix for #14608, without making this example more complicated, would be to simply limit panning to one world on the view. |
That would just be hiding the issue. It is a legitimate requirement for anyone dealing with the Pacific region. |
Even with multiple geometries there would still need to be separate |
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'm not a fan of examples that try to be full featured applications. In my opinion, an example should show a single piece of functionality, which gives it an educational value. It seems you're not sharing this view, and it seems I'm unable to convince you. Anyway, as an appreciation for your efforts, I'm going to merge this now. But I'll continue to remind you.
Fixes #14605
https://deploy-preview-14608--ol-site.netlify.app/en/latest/examples/box-selection.html