Leaflet with scale bar and URL hash
This example demonstrates a Leaflet map with a scale bar and URL hash synchronization, allowing the map’s zoom level and center coordinates to be reflected in the page URL. The map uses Stamen Toner tiles with an OpenStreetMap attribution, and the scale bar is added via `L.control.scale()`. The `leaflet-hash.js` plugin updates the hash (e.g., `#2/30.0/0.0`) on map moves and restores the view from the hash on load, using the `moveend` and `hashchange` events. The code also includes a fallback interval for older browsers without hashchange support.
AI-generated description(Needs to run locally or use the raw version to see leaflet hash)
Animated gif:
<img src="https://raw.githubusercontent.com/stamen/dwsd/master/img/leaflet_scale_hash.gif">Built with blockbuilder.org
forked from <a href='http://bl.ocks.org/enjalot/'>enjalot</a>'s block: <a href='http://bl.ocks.org/enjalot/5c780d3df8da2ecceebf117a9ac7be38'>WWSD #1: Leaflet starter</a>