diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index 77dbb721..c44cb2d1 100644 --- a/gpx/src/gpx.ts +++ b/gpx/src/gpx.ts @@ -443,7 +443,7 @@ export class TrackSegment extends GPXTreeLeaf { toTrackSegmentType(): TrackSegmentType { return { - trkpt: this.trkpt + trkpt: this.trkpt.map((point) => point.toTrackPointType()) }; } @@ -516,6 +516,15 @@ export class TrackPoint { } this.extensions["gpxtpx:TrackPointExtension"]["gpxtpx:Extensions"]["surface"] = surface; } + + toTrackPointType(): TrackPointType { + return { + attributes: this.attributes, + ele: this.ele, + time: this.time, + extensions: this.extensions, + }; + } }; export class Waypoint {