You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tested the original (legacy) meshes from GlobalMass and plotted them with plot_map(). Ignoring the fact that the meshes contain a lot of isolated triangles, I found that this map distorts the triangles that span the longitude wrapping boundary (180/-180 meridian) and makes them appear across the map like shown in the pictures below.
Zoom in close to Wrangel Island (from each side):
We need to find a way to either mask these triangles or allow splitting the triangle on each side.
The text was updated successfully, but these errors were encountered:
Yes, @mnky9800n there are multiple mentions of this issue. This was first raised in 2011 with the first release of leaflet. Unfortunately, base leaflet did not implement the fix, but it is available through the Leaflet.Antimeridian plugin. However, there is an open issue in rstudio/leaflet from 2018 to incorporate this as either as base or additional functionality, so we can't really use it in R at the moment.
The current workaround (from said 2011, in absence of support for Leaflet.Antimeridian) is to allow these objects to exceed the 180 degree boundary by adding 360 to the negative values. This cannot be done indiscriminately as we would just transfer the problem to Greenwich meridian. My suggestion is to check LONG coordinates of each polygon: if there is a mismatch in sign with other coordinates, we just add 360 to it.
For plot_mesh it is a bit more complicated. If we work, for instance, in Beringia/Chukotka, we get triangle vertices that are shared by triangles that cross the anti-meridian and also those that don't. We cannot just change the coordinates of those points. Instead, we should add new vertices with coordinates transformed. I will do more rigorous testing with this before pushing anything as I think there is a great risk of breaking something.
It can be an issue for Shiny app mesh_builder too, but I think the map is rendered differently in Shiny apps, so might need a different fix. I will check it as well.
I'll implement this through sf::st_wrap_dateline function. As it only works properly with latitudes in range between -180 and 180, I've developed a conversion function (which currently fails). Note that this only concerns the polygons, but not raster.
I tested the original (legacy) meshes from GlobalMass and plotted them with
plot_map()
. Ignoring the fact that the meshes contain a lot of isolated triangles, I found that this map distorts the triangles that span the longitude wrapping boundary (180/-180 meridian) and makes them appear across the map like shown in the pictures below.Zoom in close to Wrangel Island (from each side):
We need to find a way to either mask these triangles or allow splitting the triangle on each side.
The text was updated successfully, but these errors were encountered: