From 0d6fe4093f5d1d16ba3fde446f8ac45364914534 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Fri, 13 Sep 2024 18:44:21 +0200 Subject: [PATCH] map routepoint to trackpoint explicitly --- gpx/src/gpx.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index c6b6b8da..1191a804 100644 --- a/gpx/src/gpx.ts +++ b/gpx/src/gpx.ts @@ -104,7 +104,7 @@ abstract class GPXTreeLeaf extends GPXTreeElement { } // A class that represents a GPX file -export class GPXFile extends GPXTreeNode{ +export class GPXFile extends GPXTreeNode { [immerable] = true; attributes: GPXFileAttributes; @@ -1579,10 +1579,16 @@ function convertRouteToTrack(route: RouteType): Track { route.rtept.forEach((rpt) => { if (rpt.extensions && rpt.extensions['gpxx:RoutePointExtension'] && rpt.extensions['gpxx:RoutePointExtension']["gpxx:rpt"]) { rpt.extensions['gpxx:RoutePointExtension']["gpxx:rpt"].forEach((rptExtension) => { - segment.trkpt.push(new TrackPoint(rptExtension as TrackPointType)); + segment.trkpt.push(new TrackPoint({ + attributes: rptExtension.attributes, + })); }); } else { - segment.trkpt.push(new TrackPoint(rpt as TrackPointType)); + segment.trkpt.push(new TrackPoint({ + attributes: rpt.attributes, + ele: rpt.ele, + time: rpt.time, + })); } });