Raruto / leaflet-elevation

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

How to add the Download button to a gpxGroup map #269

Closed marcoA152 closed 1 year ago

marcoA152 commented 1 year ago

Hallo. I'm sorry to bother you but I struggling with this (my) issue: I'm trying to add a Download button to a multiple .gpx tracks map from your examples. On single gpx file map the button is shown but on multiple gpx map is not present. There is a way to add it?

Thanks in advance

Raruto commented 1 year ago

Hi Marco,

probably when using the L.GpxGroup class the following variable is not setted:

this._downloadURL = url; // see: leaflet-elevation/src/control.js#741

Take a look at this other https://github.com/Raruto/leaflet-elevation/pull/160#issuecomment-1002209215 to start monkey patching that class as you wish (aka L.Class.include()).

👋 Raruto


leaflet-gpxgroup.js

https://github.com/Raruto/leaflet-elevation/blob/ea155564475c44941cb81a9df3eaf8d633ed90fc/libs/leaflet-gpxgroup.js#L172-L177

leaflet-elevation.js

https://github.com/Raruto/leaflet-elevation/blob/ea155564475c44941cb81a9df3eaf8d633ed90fc/src/control.js#L1300-L1312

https://github.com/Raruto/leaflet-elevation/blob/ea155564475c44941cb81a9df3eaf8d633ed90fc/src/control.js#L737-L745

marcoA152 commented 1 year ago

Thank you i will try the way you have suggested, but but probably the fastest (and dirt) thing to do is to put a direct anchor to the gpx files under the "elevation-div"

Thanks for your work and for this amazing plugin!