Files
gpx.studio/gpx/src/types.ts

102 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-04-15 14:26:34 +02:00
export type GPXFile = {
2024-04-16 13:02:22 +02:00
attributes: GPXFileAttributes;
2024-04-15 14:26:34 +02:00
metadata: Metadata;
wpt: Waypoint[];
trk: Track[];
2024-04-15 14:26:34 +02:00
};
2024-04-16 13:02:22 +02:00
export type GPXFileAttributes = {
creator: string;
[key: string]: string;
};
2024-04-15 14:26:34 +02:00
export type Metadata = {
name?: string;
desc?: string;
author?: Author;
link?: Link;
time?: Date;
};
export type Link = {
2024-04-16 13:02:22 +02:00
attributes: LinkAttributes;
2024-04-15 14:26:34 +02:00
text?: string;
type?: string;
};
2024-04-16 13:02:22 +02:00
export type LinkAttributes = {
href: string;
};
2024-04-15 14:26:34 +02:00
export type Waypoint = {
2024-04-16 13:02:22 +02:00
attributes: Coordinates;
2024-04-15 14:26:34 +02:00
ele?: number;
time?: Date;
name?: string;
cmt?: string;
desc?: string;
link?: Link;
sym?: string;
type?: string;
};
2024-04-16 13:02:22 +02:00
export type Coordinates = {
lat: number;
lon: number;
};
2024-04-15 14:26:34 +02:00
export type Track = {
name?: string;
cmt?: string;
desc?: string;
src?: string;
link?: Link;
type?: string;
trkseg: TrackSegment[];
extensions?: TrackExtensions;
2024-04-16 09:54:41 +02:00
};
export type TrackExtensions = {
2024-04-16 13:02:22 +02:00
'gpx_style:line'?: LineStyleExtension;
};
export type LineStyleExtension = {
2024-04-16 09:54:41 +02:00
color?: string;
opacity?: number;
weight?: number;
2024-04-15 14:26:34 +02:00
};
export type TrackSegment = {
trkpt: TrackPoint[];
};
export type TrackPoint = {
2024-04-16 13:02:22 +02:00
attributes: Coordinates;
2024-04-15 14:26:34 +02:00
ele?: number;
time?: Date;
2024-04-16 09:54:41 +02:00
extensions?: TrackPointExtensions;
};
export type TrackPointExtensions = {
2024-04-16 13:02:22 +02:00
'gpxtpx:TrackPointExtension'?: TrackPointExtension;
'gpxpx:PowerExtension'?: PowerExtension;
};
export type TrackPointExtension = {
2024-04-16 13:02:22 +02:00
'gpxtpx:hr'?: number;
'gpxtpx:cad'?: number;
'gpxtpx:atemp'?: number;
'gpxtpx:Extensions'?: {
surface?: string;
};
}
export type PowerExtension = {
2024-04-16 13:02:22 +02:00
'gpxpx:PowerInWatts'?: number;
}
2024-04-15 14:26:34 +02:00
export type Author = {
name?: string;
email?: string;
link?: Link;
};