From ec7629aea72ced8bda235b69945837f2bf366aaa Mon Sep 17 00:00:00 2001 From: Pierre Donias Date: Fri, 13 Sep 2024 18:48:22 +0200 Subject: [PATCH] Import routes elevation and time information (#95) * Import routes elevation and time information * map routepoint to trackpoint explicitly --------- Co-authored-by: vcoppe --- gpx/src/gpx.ts | 6 +- gpx/test-data/with_routes.gpx | 253 ++++++++++++++++++++++++++++++++++ 2 files changed, 257 insertions(+), 2 deletions(-) create mode 100644 gpx/test-data/with_routes.gpx diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index 3ce6963b..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; @@ -1586,6 +1586,8 @@ function convertRouteToTrack(route: RouteType): Track { } else { segment.trkpt.push(new TrackPoint({ attributes: rpt.attributes, + ele: rpt.ele, + time: rpt.time, })); } }); @@ -1594,4 +1596,4 @@ function convertRouteToTrack(route: RouteType): Track { } return track; -} \ No newline at end of file +} diff --git a/gpx/test-data/with_routes.gpx b/gpx/test-data/with_routes.gpx new file mode 100644 index 00000000..fd55a291 --- /dev/null +++ b/gpx/test-data/with_routes.gpx @@ -0,0 +1,253 @@ + + + + with_routes + + gpx.studio + + + + + route 1 + Cycling + + 109.0 + + + 110.8 + + + 110.3 + + + 110.0 + + + 110.3 + + + 109.3 + + + 107.0 + + + 106.0 + + + 108.5 + + + 109.8 + + + 110.8 + + + 112.0 + + + 112.8 + + + 113.5 + + + 114.3 + + + 115.3 + + + 114.8 + + + 114.3 + + + 114.3 + + + 114.5 + + + 115.0 + + + 115.8 + + + 115.8 + + + 116.0 + + + 115.8 + + + 115.5 + + + 114.5 + + + 112.5 + + + 110.8 + + + 109.0 + + + 106.3 + + + 104.3 + + + 104.0 + + + 103.8 + + + 103.3 + + + 103.5 + + + 103.8 + + + 104.8 + + + 105.8 + + + 106.8 + + + 107.8 + + + 108.5 + + + 109.3 + + + 110.0 + + + 110.5 + + + 110.8 + + + 111.8 + + + 112.8 + + + 113.3 + + + + route 2 + Cycling + + 115.5 + + + 115.8 + + + 118.5 + + + 119.5 + + + 121.3 + + + 122.0 + + + 122.8 + + + 123.5 + + + 126.3 + + + 128.0 + + + 129.0 + + + 130.0 + + + 130.8 + + + 131.8 + + + 132.3 + + + 132.8 + + + 135.8 + + + 135.5 + + + 132.5 + + + 134.0 + + + 136.8 + + + 137.5 + + + 137.3 + + + 137.5 + + + 137.3 + + + 134.8 + + + 132.3 + + + 129.5 + + +