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.
- …