Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
256 stars 85 forks source link

Download link #276

Closed Willi64739 closed 10 months ago

Willi64739 commented 1 year ago

Subject of the issue

is it possible to add a download link in your sample https://github.com/Raruto/leaflet-elevation/tree/master/examples/leaflet-elevation.html?

I can see that a download link is part of the elevation control in https://github.com/Raruto/leaflet-elevation/tree/master/examples/leaflet-elevation_multiple-maps.html.

But there is no download link in https://github.com/Raruto/leaflet-elevation/tree/master/examples/leaflet-elevation_toggable-tracks.html.

I cant see where the download link is activated or deactivated in these last two samples...

Raruto commented 1 year ago

Hi @Willi64739,

basically you don't see the download link because the third example shows a different method for adding the data (which works at a lower level, also for historical reasons):

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/examples/leaflet-elevation.html#L80

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/examples/leaflet-elevation_multiple-maps.html#L103

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/examples/leaflet-elevation_toggable-tracks.html#L148

You just need to set the following value dynamically (somehow) after each toggle to make the link show again (and if necessary forcing a redraw):

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L741

For further details please search also among closed issues 👉 https://github.com/Raruto/leaflet-elevation/issues/269#issuecomment-1701228822

👋 Raruto