NUKnightLab / StoryMapJS

Maps that tell stories.
https://storymap.knightlab.com/
Other
183 stars 50 forks source link

Map display fails when non-overview slides have no location #444

Closed JoeGermuska closed 4 years ago

JoeGermuska commented 4 years ago

While the editor is resilient to this issue, published maps begin to draw, including showing the "overview" text, then fail to display a basemap or any markers.

In the console, one will see TypeError: this._northEast is undefined

This is a consequence of map markers being created with no location, and stems back to calculateMarkerZooms() called from `_onMapLoaded()

In the test case, the JSON location was:

"location": { "lat": 0, "line": true, "lon": 0, "zoom": 14 },

This seems to trace back to https://github.com/NUKnightLab/StoryMapJS/blob/master/source/js/map/leaflet/VCO.MapMarker.Leaflet.js/#L14 where lat/lon of zero are falsy

The fix is not to crudely test the lat/lon but to make sure they are valid numbers, and if they aren't, to set them to 0 rather than error.