mpetazzoni / leaflet-gpx

A GPX track plugin for Leaflet.js
http://mpetazzoni.github.io/leaflet-gpx
BSD 2-Clause "Simplified" License
550 stars 119 forks source link

failed to load track without elevation #127

Closed philippe-queinnec closed 3 years ago

philippe-queinnec commented 3 years ago

If a track has no elevation ( tag), or if the first point of a track has no elevation, loading fails. The culprit is line 488 in _parse_segment. The line ll.meta.ele = last.meta.ele; should be if (last != null) { ll.meta.ele = last.meta.ele; }

pimschaaf commented 3 years ago

Without this change I get the following error message: Uncaught TypeError: Cannot read properties of null (reading 'meta') at i._parse_segment (gpx.js:488) when elevation data is missing.

mpetazzoni commented 3 years ago

Thanks!