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

Allow user to add custom layers #77

Merged
merged 1 commit into from
May 20, 2017

Conversation

bagage
Copy link
Collaborator

@bagage bagage commented May 2, 2017

This would solve #73 but also my issue, eg. a French (super)great TMS which is for "single user" access only, so we cannot add it to Brouter but as a user I can :).

image

@krisanselmo
Copy link

Nice feature, thanks!
The use of strava heatmap overlay may be very useful (according to me) for hike or ride routing.
https://wiki.openstreetmap.org/wiki/Strava
I can't wait to test :)

@bagage
Copy link
Collaborator Author

bagage commented May 3, 2017

@krisanselmo you can give it a shot on http://brouter.damsy.net
Any feedback appreciated!

@bagage bagage force-pushed the feature/user-layers branch from eaf0bd5 to 8dcf23b Compare May 8, 2017 09:43
@nrenner
Copy link
Owner

nrenner commented May 8, 2017

Very nice addition! Indeed useful for regional, personal-use-only (German agencies also have these) and other not included maps.

Not relevant for merging, but what do you think about adding the button inside the layer switcher (e.g. just a quick hack)? I feel we should rather reduce the number of buttons on the map if not needed in daily use.

If you wanted, I guess it might even make sense to turn this into a Leaflet plugin.

@nrenner
Copy link
Owner

nrenner commented May 8, 2017

@krisanselmo I added the Strava heatmap to my todo list of potential layers to add. Would need to check the terms of use. I'm generally open for map suggestions, but would want to avoid having too many layers in the list.

@bagage
Copy link
Collaborator Author

bagage commented May 15, 2017

Not relevant for merging, but what do you think about adding the button inside the layer switcher (e.g. just a quick hack)? I feel we should rather reduce the number of buttons on the map if not needed in daily use.

Yeah sure it sounds good. Small fix first, the button should have type=button to avoid submitting POST on click. But besides that, the proposed hack cannot work as is because leaflet is iterating over input children. Do you know how to workaround this too @nrenner?

If you wanted, I guess it might even make sense to turn this into a Leaflet plugin.

Yes indeed - don't know if I'll have the time for it though.

@nrenner
Copy link
Owner

nrenner commented May 15, 2017

Small fix first, the button should have type=button to avoid submitting POST on click.

Thanks for the hint.

But besides that, the proposed hack cannot work as is because leaflet is iterating over input children.

Good catch, but would it matter if it stays button type=button, instead of input type=button? Or maybe using a styled link (a href="#", with preventDefault or stop), see Bootstrap Button tags.

Generally the hack was really just that, and more for me to see if adding a button would work at all and to show what I meant, not how to do it. There probably are better ways, perhaps none of them ideal. I haven't looked deeper, just saw that layerSwitcher.getContainer().innerHTML += '...' (or better appendChild) didn't work right away, because the button would still be shown when collapsed.

@nrenner nrenner merged commit d08bc38 into nrenner:master May 20, 2017
@nrenner
Copy link
Owner

nrenner commented May 20, 2017

Merged this now and created a separate issue for moving the button into the layer switcher: #89

nrenner added a commit that referenced this pull request Jul 25, 2017
Copied from bagage@82c9820 (dev),
missing in  bagage@8dcf23b
(feature/user-layers).
@bagage bagage mentioned this pull request May 21, 2018
@nrenner nrenner added this to the 0.7.0 milestone Aug 10, 2018
@bagage bagage deleted the feature/user-layers branch May 27, 2019 18:13
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

Successfully merging this pull request may close these issues.

3 participants