From 49d8143cc6a8104495acfd4bd38adc81b2fc2dd0 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Sun, 16 Nov 2025 11:09:37 +0100 Subject: [PATCH] fix local elevation gain computation --- gpx/src/gpx.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index 0505f7465..8a52df0d5 100644 --- a/gpx/src/gpx.ts +++ b/gpx/src/gpx.ts @@ -1030,10 +1030,10 @@ export class TrackSegment extends GPXTreeLeaf { statistics.local.distance.total[j] - statistics.local.distance.total[start]; const localEle = dist > 0 ? (localDist / dist) * ele : 0; statistics.local.elevation.gain.push( - statistics.global.elevation.gain + localEle > 0 ? localEle : 0 + statistics.global.elevation.gain + (localEle > 0 ? localEle : 0) ); statistics.local.elevation.loss.push( - statistics.global.elevation.loss + localEle < 0 ? localEle : 0 + statistics.global.elevation.loss + (localEle < 0 ? -localEle : 0) ); }