diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index 3ce6963b..c6b6b8da 100644 --- a/gpx/src/gpx.ts +++ b/gpx/src/gpx.ts @@ -1579,14 +1579,10 @@ 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({ - attributes: rptExtension.attributes, - })); + segment.trkpt.push(new TrackPoint(rptExtension as TrackPointType)); }); } else { - segment.trkpt.push(new TrackPoint({ - attributes: rpt.attributes, - })); + segment.trkpt.push(new TrackPoint(rpt as TrackPointType)); } }); @@ -1594,4 +1590,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 + + +