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

little problem when using GPX.js with leaflet elevation plugin #173

Open
emergence75 opened this issue Jun 26, 2015 · 3 comments
Open

little problem when using GPX.js with leaflet elevation plugin #173

emergence75 opened this issue Jun 26, 2015 · 3 comments

Comments

@emergence75
Copy link

in layer/vector/GPX.js
parse_trkseg: function(line, xml, options, tag) {

at the end of the method i found following...

    var l = [new L.Polyline(coords, options)];

    this.fire('addline', {line:l});
    return l;

when using the elevation plugin the data from the line is accessed via
d._latlngs

which brings an error in this case... because it would work with d[0]._latlngs

first i build a workaround in Leaflet.Elevation.0.0.4-src.js

    if (d.length == 1 && (typeof d[0] === 'object') ) { 
        d = d[0];
    }

but after some thinking the correct handling would be to change the code in parse_trkseg: function(line, xml, options, tag) {

    var l = new L.Polyline(coords, options);

    this.fire('addline', {line:l});
    return [l];

after this little change Leaflet.Elevation.0.0.4-src.js works without any further change...

@brunob
Copy link
Collaborator

brunob commented Jul 13, 2015

Hi @emergence75 i've tested your patch, it works well on gpx example, but it breaks gpx.speed script :\

@brunob
Copy link
Collaborator

brunob commented Dec 1, 2015

@emergence75 any news about an updated patch for it ?

@brunob
Copy link
Collaborator

brunob commented Dec 3, 2015

I was trying to adapt gpx.speed script in order to get this one working with your patch, but it's not working for now. I've seen that Leaflet.Elevation use a fork of gpx script that doesn't return the same type of data for _parse_trkseg() :

https://github.com/MrMufflon/Leaflet.Elevation/blob/master/lib/leaflet-gpx/gpx.js#L316 /

This will be hard to maintain compatibility between two forks of the same file... Since leaflet elevation is using a fork of gpx script, in think the "compatibility check" should be done on his side.

Any thoughts about it ?

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

2 participants