signalk-parquet
Version:
Vessel data Parquet file archive with automated value and geospatial triggers. History API compliant with cloud backups and queries.
46 lines • 1.42 kB
TypeScript
/**
* Minimal GPX parser
*
* Extracts track points (<trkpt>) from a GPX file. Waypoints and routes are
* ignored — only trkpt elements carry the <time> tag needed for partitioning
* time-series data into the parquet store.
*
* Supports GPX 1.0 and 1.1. Uses regex-based extraction rather than a full
* XML parser to avoid adding a dependency; this is safe for GPX because the
* schema is shallow and well-defined.
*
* Example input fragment:
* <trkpt lat="47.5" lon="8.7">
* <ele>412.5</ele>
* <time>2024-06-01T10:15:30Z</time>
* <speed>5.14</speed>
* <course>180.0</course>
* </trkpt>
* Produces: { latitude: 47.5, longitude: 8.7, time: Date(...), elevation: 412.5, speedMs: 5.14, courseDeg: 180 }
*/
export interface GpxPoint {
latitude: number;
longitude: number;
time?: Date;
elevation?: number;
speedMs?: number;
courseDeg?: number;
}
export interface GpxTrack {
name?: string;
points: GpxPoint[];
}
export interface GpxParseResult {
tracks: GpxTrack[];
totalPoints: number;
firstTime?: Date;
lastTime?: Date;
}
/**
* Parse a GPX XML string into structured tracks.
*
* Points without a valid lat/lon are skipped. Points without <time> are
* still returned (caller may drop them) — the time field is undefined.
*/
export declare function parseGpx(xml: string): GpxParseResult;
//# sourceMappingURL=gpx-parser.d.ts.map