-
Notifications
You must be signed in to change notification settings - Fork 508
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
Support for crossing the date line (anti-meridian) for polylines and polygons #553
Comments
Without having had a look at the plugin, does it also work for raster images? See the first ever mapview issue r-spatial/mapview#6 |
I don't believe so. It should be possible to adjust the raster to have longitudes larger than +- 180. This is Leaflet.js's suggested method (The requirement of Doing the adjustment with polyline... library(leaflet);
leaflet() %>%
addTiles() %>%
addPolygons(c(140.0, -120.0 + 360, 170.0), c(20, 50, 70)) This R package implements adjusting a raster to wrap from [0, 360] instead of [-180, 180]. (Even with a comment to an existing issue!) @tim-salabim, Would either of these work? |
@schloerke thanks for the quick reply. Unfortunately, the suggested adjustment does not work with rasterImages. The solution with crop and shift is close, but not optimal. I'll have a closer look again... Sorry to hijack this! |
Np! I've seen this "feature" issue multiple times now. Thought I'd formalize it into an issue. Would be interesting to try an treat it as a "set-able" line for polyline and polygons. Would not need to force the wrapping to occur at -180 or at 0. Could easily be done with any other value, like 42, which would cause the range to be [42, 42 + 360]. |
Thanks for keeping this topic moving forward. For those of us who regularly work in the Pacific, it will be great to have a straightforward workflow in place. Down the line, I would be happy to contribute a vignette with example code and workflow best practices when dealing with the anti-meridian issue. |
Linking to raster issue: #225 |
My team is running into this issue. Are you aware of any effort to fix it and integrate it with the core leaflet R package. |
Original reference from #550
Leaflet.Antimeridian
See this plugin that could be used with leaflet: https://github.com/briannaAndCo/Leaflet.Antimeridian
Normal leaflet (from plugin README)
With anti-meridian plugin: (from plugin README)
While this is typically something that would be better for leaflet.extras, I believe this is a VERY common situation and should be apart of the core leaflet R package.
Bad Example
The polygon should be over the Atlantic ocean, not all of Eurasia.
The text was updated successfully, but these errors were encountered: