Skip to content

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

Open
@emergence75

Description

@emergence75

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions