fixes total distance computation
This commit is contained in:
@@ -35,6 +35,9 @@ class GpxMetricsComputation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.totalDistance += distance;
|
this.totalDistance += distance;
|
||||||
|
|
||||||
|
this.lastFilteredPointXY = point;
|
||||||
|
|
||||||
const elevation = point.ele ?? 0;
|
const elevation = point.ele ?? 0;
|
||||||
// @ts-ignore I know this.lastZ is not null
|
// @ts-ignore I know this.lastZ is not null
|
||||||
const elevationDiff = elevation - this.lastZ;
|
const elevationDiff = elevation - this.lastZ;
|
||||||
@@ -52,7 +55,6 @@ class GpxMetricsComputation {
|
|||||||
|
|
||||||
this.totalDistanceSmoothed += distance;
|
this.totalDistanceSmoothed += distance;
|
||||||
|
|
||||||
this.lastFilteredPointXY = point;
|
|
||||||
// @ts-ignore: I know this.lastFilteredZ is not null
|
// @ts-ignore: I know this.lastFilteredZ is not null
|
||||||
const elevationDiffSmoothed = elevation - this.lastFilteredZ;
|
const elevationDiffSmoothed = elevation - this.lastFilteredZ;
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ export default class GPX {
|
|||||||
const pointLength = points.length
|
const pointLength = points.length
|
||||||
for (let i = 1; i < pointLength; i++) {
|
for (let i = 1; i < pointLength; i++) {
|
||||||
const point = points[i];
|
const point = points[i];
|
||||||
metrics.addAndFilter(point)
|
metrics.addAndFilter(point)
|
||||||
|
|
||||||
totalLat += point.$.lat ?? 0;
|
totalLat += point.$.lat ?? 0;
|
||||||
totalLon += point.$.lon ?? 0;
|
totalLon += point.$.lon ?? 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user