fix extensions and attributes

This commit is contained in:
vcoppe
2024-04-16 13:02:22 +02:00
parent 3dc9b7d703
commit b5eebacc02
7 changed files with 1365 additions and 1163 deletions

View File

@@ -1,10 +1,15 @@
export type GPXFile = {
creator: string;
attributes: GPXFileAttributes;
metadata: Metadata;
wpt: Waypoint[];
trk: Track[];
};
export type GPXFileAttributes = {
creator: string;
[key: string]: string;
};
export type Metadata = {
name?: string;
desc?: string;
@@ -14,14 +19,17 @@ export type Metadata = {
};
export type Link = {
href: string;
attributes: LinkAttributes;
text?: string;
type?: string;
};
export type LinkAttributes = {
href: string;
};
export type Waypoint = {
lat: number;
lon: number;
attributes: Coordinates;
ele?: number;
time?: Date;
name?: string;
@@ -32,6 +40,11 @@ export type Waypoint = {
type?: string;
};
export type Coordinates = {
lat: number;
lon: number;
};
export type Track = {
name?: string;
cmt?: string;
@@ -44,7 +57,7 @@ export type Track = {
};
export type TrackExtensions = {
line?: LineStyleExtension;
'gpx_style:line'?: LineStyleExtension;
};
export type LineStyleExtension = {
@@ -58,29 +71,28 @@ export type TrackSegment = {
};
export type TrackPoint = {
lat: number;
lon: number;
attributes: Coordinates;
ele?: number;
time?: Date;
extensions?: TrackPointExtensions;
};
export type TrackPointExtensions = {
TrackPointExtension?: TrackPointExtension;
PowerExtension?: PowerExtension;
'gpxtpx:TrackPointExtension'?: TrackPointExtension;
'gpxpx:PowerExtension'?: PowerExtension;
};
export type TrackPointExtension = {
hr?: number;
cad?: number;
atemp?: number;
Extensions?: {
'gpxtpx:hr'?: number;
'gpxtpx:cad'?: number;
'gpxtpx:atemp'?: number;
'gpxtpx:Extensions'?: {
surface?: string;
};
}
export type PowerExtension = {
PowerInWatts?: number;
'gpxpx:PowerInWatts'?: number;
}
export type Author = {