leaflet-fullhash

1.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i leaflet-fullhash

Weekly Downloads

9

Version

1.0.0

License

ISC

Unpacked Size

7.36 kB

Total Files

4

Last publish

Collaborators

  • sagarpreet