Add URL hash for Leaflet map (map view and active layers)
Switch branches/tags
Nothing to show
Clone or download
KoGor Update method changed, removing layers scope fixed #2
Scope of "this" changed (context) when removing layers.
Latest commit 104a08c Mar 19, 2016
Permalink
Failed to load latest commit information.
LICENSE Initial commit Nov 16, 2014
README.md Update README.md Nov 16, 2014
leaflet-fullHash.js Update method changed, removing layers scope fixed #2 Mar 19, 2016

README.md

leaflet-fullHash

Add dynamic URL hash for Leaflet map (map view and active layers). For those who also lack layers state in leaflet-hash plugin. Now you can easily link user to specific map view with certain active layers.

Demo

You can view a demo of leaflet-fullHash here: kogor.github.io/leaflet-fullHash.

Getting started

  1. Include leaflet-fullHash.js.

  2. Once you have initialized the map (an instance of L.Map), add the following code:

        // Assuming your map instance is in a variable called map
        var allMapLayers = {'base_layer_name': leaflet_layer_object,
                            'overlay_name': leaflet_layer_object,
                            'another_overlay_name': leaflet_layer_object};
        var hash = new L.Hash(map, allMapLayers);

Here leaflet_layer_object should be instance of any Leaflet layer (based on ILayer).

License

MIT License. See LICENSE for details.