gps-wizard

GPS Exchange Format (GPX) - WindsportTracker

Background

The GPX home page summarises the importance of GPX validation and best practices. It is very simple and straightforward to ensure the WindsportTracker exports are compliant with the GPX 1.0 standard. This document describes how to achieve the goal of GPX 1.0 compliance / compatibility.

GPX Validation

There are numerous ways to check compliance and validate a GPX file against the XSD. Several approaches are described at the GPX home, but the simplest approach is to use an online validator such as the one at freeformatter.com.

This example has been fixed by hand to ensure compliance with the GPX 1.0 schema. Simply paste it into the XML Validator and press “Validate XML”.

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.0"
     creator="WindsportsTracker"
     xmlns="http://www.topografix.com/GPX/1/0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:wst="https://www.windsporttracker.com/"
     xsi:schemaLocation="http://www.topografix.com/GPX/1/0
                         https://logiqx.github.io/gps-wizard/xmlschemas/topografix/gpx/1/0/gpx-lax.xsd">
  <time>2022-11-19T17:22:14.15Z</time>
  <trk>
    <name>Windsport Back Home</name>
    <wst:gpx version="1" recordtype="RECORD" sessiontype="FREERIDE" rating="2" uuid="ce304c15-df1a-4cc0-8f30-7a3eeafbc720" startTime="2022-11-19T17:22:14.15Z" endTime="2022-11-19T17:28:25.132Z" id="/t4/zT4qofHBiYd3bRvuRQ==&#10;" device="SM-G930F" />
    <trkseg>
      <trkpt lat="50.565995350" lon="-2.452116667">
        <ele>66</ele>
        <time>2003-04-05T18:22:16.184+01:00</time>
        <course>308</course>
        <speed>0.8020791</speed>
        <src>gps</src>
        <sat>0</sat>
        <hdop>1.0</hdop>
        <vdop>1.5</vdop>
        <pdop>1.8</pdop>
        <wst:trkpt accuracy="12" elapsedrealtimenanos="0" />
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Note: The URL in xsi:schemaLocation is pointing at a “lax” version of the GPX 1.0 schema that does not mandate an XSD for the WST extensions. The link to https://logiqx.github.io should only be used during the development and testing of WST, not for public releases of WST.

Changes Required

The above example was based on a GPX file generated by WST, but a number of changes were required for GPX 1.0 compliance. None of them are particularly complicated but GPX compliance will ensure that exports can be loaded into other applications without issues.

XML Declaration

WST includes the following declaration:

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>

The standalone parameter is redundant since there is no DTD and can be removed:

<?xml version="1.0" encoding="UTF-8"?>

Note: No space is required after UTF-8 and double quotes can be used nowadays - reference is w3.org.

GPX Schema Location

The xsi:schemaLocation was not defined correctly:

<gpx version="1.0"
     creator="WindsportsTracker"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="http://www.topografix.com/GPX/1/0"
     n0:schemaLocation="http://www.topografix.com/GPX/1/0
                        http://www.topografix.com/GPX/1/0/gpx.xsd"
     xmlns:n0="xsi">

The proper syntax is shown below, using the official GPX 1.0 schema location:

<gpx version="1.0"
     creator="WindsportsTracker"
     xmlns="http://www.topografix.com/GPX/1/0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:wst="https://www.windsporttracker.com/"
     xsi:schemaLocation="http://www.topografix.com/GPX/1/0
                         https://www.topografix.com/GPX/1/0/gpx.xsd">

Note the addition of xmlns:wst for the extensions to GPX 1.0.

Geoid Height

The value “null” is not valid for <geodheight>:

<geoidheight>null</geoidheight>

geoidheight can however be calculated by WST, feel free to Google for confirmation:

geoid height = height above ellipsoid - height above geoid

Note that I have not checked whether WST uses height above ellipsoid, or height above geoid for elevation. The correct one to use is height above the geoid, commonly referred to as height above MSL.

Precision

Latitude and longitude use 9 decimal places which equates to precision of 0.11 mm. 7 decimals would be adequate, equating to 1.1 cm.

<trkpt lat="50.5659953" lon="-2.4521166">

Speed uses 7 decimal places which equates to precision of 1 / 10,000 th of a mm/s. 3 decimals would be adequate, equating to 1 mm /s.

<speed>0.802</speed>

WST Elements

The <trkpt> elements contain <trkptwst> elements:

<trkptwst accuracy="12" elapsedrealtimenanos="0" />

GPX 1.0 allows for extensions after the standard <trkpt> elements, but they must have a different namespace:

<wst:trkpt accuracy="12" elapsedrealtimenanos="0" />

The <trk> element also contains a <wst> element:

<wst version="1" recordtype="RECORD" sessiontype="FREERIDE" rating="2" uuid="ce304c15-df1a-4cc0-8f30-7a3eeafbc720" startTime="2022-11-19T17:22:14.15Z" endTime="2022-11-19T17:28:25.132Z" id="/t4/zT4qofHBiYd3bRvuRQ==&#10;" device="SM-G930F" />

This needs to be moved above the <trkseg> element(s), but can remain within the <trk> element:

<wst:gpx version="1" recordtype="RECORD" sessiontype="FREERIDE" rating="2" uuid="ce304c15-df1a-4cc0-8f30-7a3eeafbc720" startTime="2022-11-19T17:22:14.15Z" endTime="2022-11-19T17:28:25.132Z" id="/t4/zT4qofHBiYd3bRvuRQ==&#10;" device="SM-G930F" />

Note that this element also makes use of the <wst> namespace.

Timestamps

Timestamps in GPX files from WST are showing the time zone applicable at the time of recording:

<time>2003-04-05T18:22:16.184+01:00</time>

This is perfectly valid, although most GPS / GNSS loggers record the time as UTC. It’s conceivable that some applications may not make use of the time zone that is supplied when they read GPX files (+01:00 in this example).

Summary

Since the GPX exports of WST are based on GPX 1.0 the <speed> elements will be recognised by GPSResults, Gpsar, GPS Speedreader, KA72, etc.

However, the exports from WST are not actually GPX 1.0 compliant and as such can be improved relatively easily. Garmin’s Basecamp and MapSource currently reject GPX files created by WST but will accept GPX 1.0 compliant files.

Applying the changes described above will ensure that GPX files from WST can be loaded into most software, including products by Garmin such as Basecamp and Mapsource.

Validation can be performed against gpx-lax.xsd which does not mandate an XSD for the WST extensions. Should you wish to support strict validation, I would be happy to assist by creating a suitable XSD.