-
-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URL hash with wrong coordinates throws Error #5131
Comments
Hi, thanks for taking the time to report this issue. |
I can imagine this: App uses Hash routing, so users can save or edit URLs to their locations, but can accidentally create URL with incorrect coordinates. I think the map should not fail, but fallback somehow. I know the app developers can also check it before it falls down to MapLibre, but I think it would be nice if the MapLibre will fail more gracefully. |
Feel free to sumbit a PR. I think the hash control is mainly for testing and development, but you are welcome to improve it. |
I think it's useful for any application like openstreetmap.org or Google Maps to add hash with coordinates. It makes it really easy to reload or share the map view with others. I guess there is a lot of such examples that uses MapLibre (osmapp.org,...). I'm not very familiar with MapLibre code. Can you please point me quickly where I should start to investigate the code for parsing hash on map load or even check if |
The hash related code is here: Line 11 in 8dba921
|
maplibre-gl-js version: 4.7.1
browser: Chrome 131
Steps to Trigger Behavior
center: [36, 129]
, swapped order means latitude > 90The same happens if center is set correctly, but the hash is incorrect.
Link to Demonstration
https://codepen.io/mattesCZ/pen/gbYbOKm
Expected Behavior
I think at least URL hash should be checked if it's valid coordinate and fallback to some valid coordinate like [0, 0] and zoom 0 if it's invalid.
Actual Behavior
It shows empty map if coordinate is incorrect and throws errors in console.
The text was updated successfully, but these errors were encountered: