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

ll.meta.ele can be null #89

Closed frederikbosch closed 4 years ago

frederikbosch commented 4 years ago

When ll.meta.ele is null (which is possible), problems are caused when calling get_elevation_data, specifically return a.toFixed(2) + ' km, ' + b.toFixed(0) + ' m';, there b cannot be null because toFixed cannot be called on null.

mpetazzoni commented 4 years ago

What's the impact of a 0-elevation point on the calculation of elevation gain/loss?

frederikbosch commented 4 years ago

@mpetazzoni If you think there is an impact, then maybe this is better solved directly in the get_elevation_data. Before calling the map method, maybe do a filter on null values first.