Skip to content

a1an77/leaflet-hash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaflet-hash

Leaflet-hash lets you to add dynamic URL hashes to web pages with Leaflet maps. You can easily link users to specific map views.

Leaflet-hash

Demo

You can view a demo of leaflet-hash at mlevans.github.io/leaflet-hash/map.html.

Getting started

  1. Prepare a basic leaflet map. You can find instructions on Leaflet's quick-start guide.

  2. Include leaflet-hash.js.

  3. 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 hash = new L.Hash(map);

Optional parameter

If you want to store an optional parameter in the hash you have to prepare an object to get/set the parameter in your application and pass it to the constructor of the hash. The parameter object must implement two methods: 'get' and 'set' to respectively get the current value of the parameter to be used in the hash or to set the map/application state according to the parameter present in the hash.

Author

@mlevans

Contributors

@calvinmetcalf

@jfirebaugh

@rsudekum

@tmcw

@yohanboniface

License

MIT License. See LICENSE for details.

About

Add URL hashes to web pages with Leaflet maps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.7%
  • HTML 0.3%