Page MenuHomePhabricator

Investigation: Look into options to improve issues around the limited 0° meridian centered view
Closed, ResolvedPublic

Assigned To
None
Authored By
WMDE-Fisch
Mar 15 2023, 3:37 PM
Referenced Files
F36914728: Over180.png
Mar 16 2023, 6:24 PM
F36914726: Over180 Dynamic.png
Mar 16 2023, 6:24 PM
F36914705: Chukotka Dynamic.png
Mar 16 2023, 5:10 PM
F36914703: Chukotka.png
Mar 16 2023, 5:10 PM
F36914701: Equator Dynamic.png
Mar 16 2023, 5:10 PM
F36914698: Equator.png
Mar 16 2023, 5:10 PM
F36913196: Screenshot from 2023-03-15 17-46-28.png
Mar 15 2023, 4:48 PM

Description

Issue:

By default Leaflet shows data drawn onto the world map within a fixed boundary that horizontally goes from -180° to 180° and centers around 0°. Shapes that span across the meridian will be cut of on both sides and currently its not possible to zoom the map to a position where both can be shown. See example with markers:

Screenshot from 2023-03-15 17-46-28.png (486×655 px, 72 KB)

Briefly look into options that might help improve the situation for these edge cases. For use cases see e.g. T195654 or T313615

Findings and resources:

Static maps do not exactly have that problem. They draw the map once and provide a stitched version by repeating the drawing horizontally.

See https://en.wikipedia.beta.wmflabs.org/wiki/Maptests/Anti-meridian#A_line_on_the_equator.
Static

Equator.png (350×700 px, 20 KB)
vs Dynamic
Equator Dynamic.png (320×700 px, 102 KB)

Or from https://fr.wikipedia.org/wiki/Utilisateur:WikedKentaur/polygon ( originally from T195654 )
Static
Chukotka.png (400×400 px, 15 KB)
vs Dynamic
Chukotka Dynamic.png (320×700 px, 137 KB)


Dynamic maps on the other hand provide the option to draw across the anti-meridian by setting values >180°

See https://en.wikipedia.beta.wmflabs.org/wiki/Maptests/Anti-meridian#/map/0 ( originally from T313615 )
Dynamic

Over180 Dynamic.png (320×700 px, 104 KB)

Because the static mode "just" repeats the rendered world within the 180° some info is lost there though
Over180.png (350×700 px, 22 KB)


Ideas to move forward:

On the dynamic maps copy and repeat the data from the central base map to the maps left and right, similar to what happens on the static map.

  • At least for markers there's a library supporting that https://gitlab.com/IvanSanchez/Leaflet.RepeatedMarkers and there are suggestions to do this for lines/polygons as well
  • Additionally to that we could try to limit the view so that only "one" world can be seen on the dynamic map. This could be done by limiting the zoom and cutting the viewport.
  • Note, that similar to what's currently happening on the static map, this is incompatible with drawing features over the >180°

Identify features that cross the anti-meridian and convert them to values >180°

  • For features like in the example at the top or a split shape like in F36914705 this method could move the "split" parts together at one end and the map's focus could be set there then when in dynamic mode. The effect then could be similar to what's visible in the static mode F36914703.
  • This might allow to also keep representing features defined over the >180°
  • Identifying the relevant features and their boundaries is the most tricky to almost impossible part here. Bringing some shapes in "order" with this method might break other shapes on the map.

Other resources

Event Timeline

WMDE-Fisch updated the task description. (Show Details)
WMDE-Fisch moved this task from Doing to Demo on the WMDE-TechWish-Sprint-2023-03-14 board.
WMDE-Fisch renamed this task from Investigation: Look into leaflet options to improve issues of the 0° centered view to Investigation: Look into options to improve issues around the limited 0° meridian centered view.Mar 17 2023, 11:16 AM