Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add more parameters to persist #5

Open
petzlux opened this issue Oct 17, 2012 · 5 comments
Open

How to add more parameters to persist #5

petzlux opened this issue Oct 17, 2012 · 5 comments

Comments

@petzlux
Copy link

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
Copy link
Contributor

tmcw commented Dec 21, 2013

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

@sephcoster
Copy link

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:
http://localhost/map/#&myparam=blue&zoom=11&lat=41.8647&lon=-87.8244&category=sequential&action=all-apps

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
Copy link

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? http://www.openstreetmap.org/#map=15/37.7984/-122.2768&layers=C

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.

@schaeferlea
Copy link

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

@animaux
Copy link

animaux commented Feb 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants