Skip to content

Commit

Permalink
Fix parsing of tracks that don't have an elevation (closes #127)
Browse files Browse the repository at this point in the history
Don't assume previous point existed if the current point doesn't have an
elevation, as it may simply just be the first point of the track!
  • Loading branch information
mpetazzoni committed Sep 15, 2021
1 parent a1b4f07 commit 758fdf3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ L.GPX = L.FeatureGroup.extend({
} else {
// If the point doesn't have an <ele> tag, assume it has the same
// elevation as the point before it (if it had one).
ll.meta.ele = last.meta.ele;
ll.meta.ele = last != null ? last.meta.ele : null;
}
var ele_diff = last != null ? ll.meta.ele - last.meta.ele : 0;
var dist_3d = last != null ? this._dist3d(last, ll) : 0;
Expand Down

0 comments on commit 758fdf3

Please sign in to comment.