GPX

GPX (short for GPX exchange format) is an XML file type used to store coordinates data. It is used as a common way to share coordinates amongst softwares and applications. It is defined with this open format : https://www.topografix.com/GPX/1/1/gpx-strict.xsd.

There are three data types :

Coordinates are Latitude and Longitude in decimal degrees. Elevation is in meters. Dates and times are in UTC.

Per its specifications, a GPX file is valid as long as every single waypoint has coordinates.

For the Corsica project, I only used tracks and track segments. Here are the types I used to parse a GPX file :

export interface GPXTrkPart {
  __ATTRIBUTE__lat: string,
  __ATTRIBUTE__lon: string,
  ele: number,
  time?: string
}

export interface GPXJson {
    '?xml': {
        __ATTRIBUTE__version: string,
        __ATTRIBUTE__encoding: string
    },
    gpx: {
        '__ATTRIBUTE__creator': string,
        '__ATTRIBUTE__xmlns:xsi': string,
        '__ATTRIBUTE__xsi:schemaLocation': string,
        '__ATTRIBUTE__version': string,
        '__ATTRIBUTE__xmlns': string
        metadata?: {
          time?: string
        },
        trk: {
          name: string,
          type: string,
          trkseg: {
              trkpt: Array<GPXTrkPart>
          }
        }
    }
}