fixes total distance computation

This commit is contained in:
Christian Beutel
2025-03-14 18:21:09 +01:00
parent e5a28d2c42
commit ec15392c31
2 changed files with 4 additions and 2 deletions

View File

@@ -35,6 +35,9 @@ class GpxMetricsComputation {
);
this.totalDistance += distance;
this.lastFilteredPointXY = point;
const elevation = point.ele ?? 0;
// @ts-ignore I know this.lastZ is not null
const elevationDiff = elevation - this.lastZ;
@@ -52,7 +55,6 @@ class GpxMetricsComputation {
this.totalDistanceSmoothed += distance;
this.lastFilteredPointXY = point;
// @ts-ignore: I know this.lastFilteredZ is not null
const elevationDiffSmoothed = elevation - this.lastFilteredZ;

View File

@@ -119,7 +119,7 @@ export default class GPX {
const pointLength = points.length
for (let i = 1; i < pointLength; i++) {
const point = points[i];
metrics.addAndFilter(point)
metrics.addAndFilter(point)
totalLat += point.$.lat ?? 0;
totalLon += point.$.lon ?? 0;