Leaflet Plugin for Multiple Parameters

TL;DR: I revised a plugin for Leaflet that allows for custom hash parameters! Leaflet Hash - Custom Params

It's been entirely too long since I've sat down to write, but the past six months have been fruitful - lots of work with mapping, new front-end frameworks, Node.JS, and of course plenty of code shipped.

Part of my work involved designing a mapping application to enable URL-sharing, not just for formal URL parameters, but also for exact center points and zooms for the map. A quick search of the plugin-list yielded the Leaflet-Hash plugin which updates the URL hash with x,y and zoom coordinates when the map moves.

This works really well - totally recommend it, but a side effect of the plugin is that it removes an other hash parameters you might be using. I wanted to include other selection options on the page including layers and filter parameters.

To do this, I forked the code and built a version of Leaflet-hash that names each parameter (no ordering required), allows the inclusion of additional hash params, and includes hash functions to add, update, and discover existing params. For Example:
http://myurl/#?lat=-87.1234&lon=123&customparam=sdasdfasdf

This is my first plugin revision attempt - I welcome any suggestions and Pull Requests you want to throw at me.

Happy mapping!

Author

Seph Coster

Geek, father, sailor, wonk. Experienced public sector technology consultant, ocean racer, and diaper changer.

comments powered by Disqus