Giter Club home page Giter Club logo

Comments (2)

Raruto avatar Raruto commented on June 7, 2024

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 #160 (comment) to start monkey patching that class as you wish (aka L.Class.include()).

👋 Raruto


leaflet-gpxgroup.js

_loadGeoJSON: function(geojson, fallbackName) {
if (geojson) {
geojson.name = geojson.name || (geojson[0] && geojson[0].properties.name) || fallbackName;
this._loadRoute(geojson);
}
},

leaflet-elevation.js

if (this.options.downloadLink && this._downloadURL) { // TODO: generate dynamically file content instead of using static file urls.
this._summary._container.innerHTML += '<span class="download"><a href="#">' + L._('Download') + '</a></span>'
_.select('.download a', this._summary._container).onclick = (e) => {
e.preventDefault();
let event = { downloadLink: this.options.downloadLink, confirm: _.saveFile.bind(this, this._downloadURL) };
if (this.options.downloadLink == 'modal' && typeof CustomEvent === "function") {
document.dispatchEvent(new CustomEvent("eletrack_download", { detail: event }));
} else if (this.options.downloadLink == 'link' || this.options.downloadLink === true) {
event.confirm();
}
this.fire('eletrack_download', event);
};
}

_loadFile(url) {
fetch(url)
.then((response) => response.text())
.then((data) => {
this._downloadURL = url; // TODO: handle multiple urls?
this._parseFromString(data)
.then( geojson => geojson && this._loadLayer(geojson));
}).catch((err) => console.warn(err));
},

from leaflet-elevation.

marcoA152 avatar marcoA152 commented on June 7, 2024

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!

from leaflet-elevation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.