Page MenuHomePhabricator

Stop showing the entire world in case of an error
Open, Needs TriagePublic

Description

Maps (Kartographer) offers an optional auto-centering and/or auto-zooming feature. There will always be situations where this can't work, either when there is just no GeoJSON data to derive a bounding box from or when the GeoJSON is missing or broken because of an error somewhere else. The current behavior in all these cases is that the entire world is rendered. Often 3 times or more next to each other, depending on the width/height aspect ratio.

The smallest possible example for such an extreme map is <mapframe width="600" height="200"></mapframe>. The relevant code is here: https://phabricator.wikimedia.org/diffusion/MSKA/browse/master/lib/snapshot/autoPosition.js.

This is almost entirely useless for both readers as well as editors currently working on the map. What we want instead is a message (e.g. rendered as <svg>) that helps the editors understand that there is an error, and ideally where and how it can be fixed.

Possible steps forward:

  • A quick improvement might be to keep lat/lon at zero, but make the zoom fall back to 19 instead of 0. This will render an empty blue rectangle (actually a piece of the Atlantic ocean, also known as Null Island) instead of a world map. Here is an example how this looks like: <mapframe width="600" height="200" zoom="19"></mapframe>
  • Decide on a proper visualization. T258477#8250350 shows how this might look like when we use nothing but existing GeoJSON features.
  • It shouldn't matter if the GeoJSON is actually empty or not. When no bounding box can be derived from the available GeoJSON it's very, very unlikely that Leaflet can render anything meaningful from the same GeoJSON.
  • An option might be to leave the fullscreen experience untouched, i.e. show the entire world as before. This allows the user to see if there is anything rendered. They can scroll and zoom and use the coordinates from the sidebar to come up with a useful center and zoom.

Event Timeline

Change 833796 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/services/kartotherian@master] [POC] Don't fall back to the entire world in case of an error

https://gerrit.wikimedia.org/r/833796

Thanks for writing this task! We might also consider something as simple as showing a broken-image icon as a first step, if we think that's better than the triple-world...

I will put this in the preparation column and assign to myself to determine the best approach. I think leaving it as-is for now is fine, as the broken image icon is not giving the user much more information on what is wrong. Will think about this in combination with the rest of the error/broken maps tickets.

Change 833796 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/services/kartotherian@master] [POC] Don't fall back to the entire world in case of an error

Reason:

Solved in I46f9721.

https://gerrit.wikimedia.org/r/833796