Skip to content

How to add more parameters to persist #5

petzlux opened this Issue Oct 17, 2012 · 4 comments

5 participants

petzlux commented Oct 17, 2012

Wondered how one would go about adding more parameters apart from lat,lng,zoom . For example to persist layer ordering and display ?

tmcw commented Dec 21, 2013

Duplicate of #32, which is a duplicate of #10?


I played around with adding named hash parameters to the map so you could track them and use them regardless of order in your URL. As we all know hashes (especially those that look like normal params) can be tricky so think about the trade-offs using these vs. actual params if you go this route.

My changes move away from the original intent of leaflet-hash quite a bit so I didn't submit a pull request, but if people think it'd be useful it's available on my fork or I can submit a PR here on a branch or something.

The following format works and will get detected and center the map with the forked code:

The code also includes a couple of helpers to get params, update params, and remove them. Obviously no warranties and happy to take suggestions.

almccon commented Sep 25, 2015

@sephcoster That looks really interesting. Have you considered keeping the leaflet-hash string as one param, similar to how the OSM website does it?

That way it's a lot easier to copy and paste that 15/37.7984/-122.2768 string from one map provider to another, assuming they both support the leaflet-hash format.


Has anyone an idea how to make a hash including the base maps and all chosen geojason layers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.