gpx-ideas

Proposal for GPX

Garmin Testing

This document summarises the behavior of Garmin Connect, BaseCamp and MapSource when importing / loading GPX files:

Garmin Connect

These findings are based on modificationsto a fairly simple GPX file, tweaking the <gpx> attributes and the contents of a single<trkpt> element.

To summarise:

GPX 1.0

The GPX import is not particularly strict.

It allows the following misdemeanors in GPX 1.0 files:

This file is not GPX 1.0 compliant, but it can be successfully imported into Connect:

<?xml version="1.0" encoding="UTF-8" ?>
<gpx 
version="1.9"
creator="Some App"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xmlns:ns3="http://www.tbc.com/xmlschemas/TrackPointExtension/TBC"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.tbc.com/xmlschemas/GPX/TBC">
  <metadata>
    <time>2022-10-29T12:55:24.000Z</time>
  </metadata>
  <trk>
    <name>Waterspeed Activity 450bce8c-04cc-4dfc-8360-a55aade3f1c8</name>
    <trkseg>
      <trkpt lat="50.5712812557" lon="-2.4565191617">
        <ele>0</ele>
        <time>2022-10-29T12:55:52.000Z</time>
        <tbc>???</tbc>
        <fix>2d</fix>
        <extensions>
          <ns3:TrackPointExtension>
            <ns3:tbc>74</ns3:tbc>
          </ns3:TrackPointExtension>
        </extensions>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Issues in the example above include:

Notes:

GPX 1.1

What has been written above also applies to GPX 1.1 files - i.e. xmlns="http://www.topografix.com/GPX/1/1"

Non-standard GPX 1.1 elements are basically ignored by the GPX import.

GPX 1.1.1 / 1.2

Connect will only import GPX files when xmlns is "http://www.topografix.com/GPX/1/0" or "http://www.topografix.com/GPX/1/1".

This is potentially problematic because you can’t refer to future versions of the GPX standard, even with a suitable xsi:schemaLocation defined:

However, there is a simple workaround to import newer versions of GPX files into Connect:

The workaround is a little ugly but in the medium-term, Garmin could perhaps tweak Connect to recognise additional namespace(s) - e.g. xmlns="http://www.topografix.com/GPX/1/1/1".

Garmin BaseCamp

These findings are based on modifications to a fairly simple GPX file, tweaking the <gpx> attributes and the contents of a single<trkpt> element.

To summarise:

GPX 1.0

The GPX 1.0 import is not particularly strict.

It allows the following misdemeanors in GPX 1.0 files:

This file is not GPX 1.0 compliant, but it can be successfully imported into BaseCamp:

<?xml version="1.0" encoding="UTF-8" ?>
<gpx 
version="1.9"
creator="Some App"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xmlns:ns3="http://www.tbc.com/xmlschemas/TrackPointExtension/TBC"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.tbc.com/xmlschemas/GPX/TBC">
  <metadata>
    <time>2022-10-29T12:55:24.000Z</time>
  </metadata>
  <trk>
    <name>Waterspeed Activity 450bce8c-04cc-4dfc-8360-a55aade3f1c8</name>
    <trkseg>
      <trkpt lat="50.5712812557" lon="-2.4565191617">
        <ele>0</ele>
        <time>2022-10-29T12:55:52.000Z</time>
        <tbc>???</tbc>
        <fix>2d</fix>
        <extensions>
          <ns3:TrackPointExtension>
            <ns3:tbc>74</ns3:tbc>
          </ns3:TrackPointExtension>
        </extensions>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Issues in the example above include:

Notes:

GPX 1.1

The GPX 1.1 validator is much stricter than for GPX 1.0.

It does not allow misdemeanors that are possible in GPX 1.0 files:

This file is not quite GPX 1.1 compliant (namespace / schema location issues), but can be successfully imported into BaseCamp:

<?xml version="1.0" encoding="UTF-8" ?>
<gpx 
version="1.1"
creator="Some App"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:ns3="http://www.tbc.com/xmlschemas/TrackPointExtension/TBC"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.tbc.com/xmlschemas/GPX/TBC">
  <metadata>
    <time>2022-10-29T12:55:24.000Z</time>
  </metadata>
  <trk>
    <name>Waterspeed Activity 450bce8c-04cc-4dfc-8360-a55aade3f1c8</name>
    <trkseg>
      <trkpt lat="50.5712812557" lon="-2.4565191617">
        <ele>0</ele>
        <time>2022-10-29T12:55:52.000Z</time>
        <fix>2d</fix>
        <extensions>
          <ns3:TrackPointExtension>
            <ns3:tbc>74</ns3:tbc>
          </ns3:TrackPointExtension>
        </extensions>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Issues in the example above include:

Notes:

GPX 1.1.1 / 1.2

BaseCamp will only import GPX files when xmlns is "http://www.topografix.com/GPX/1/0" or "http://www.topografix.com/GPX/1/1".

This is potentially problematic because you can’t refer to future versions of the GPX standard, even with a suitable xsi:schemaLocation defined:

However, there is a simple workaround to import newer versions of GPX files into BaseCamp :

The workaround is a little ugly but in the medium-term, Garmin could perhaps tweak BaseCamp to use the “relaxed” GPX 1.0 loader when another namespace (or version) is encountered - e.g. xmlns="http://www.topografix.com/GPX/1/1/1".

Garmin MapSource

GPX 1.0

The GPX 1.0 loader of MapSource is much stricter than the GPX 1.0 import of BaseCamp.

The loader does not allow the misdemeanors that are allowed by BaseCamp:

This file is not quite GPX 1.0 compliant (namespace / schema location issues), but can be successfully imported into MapSource:

<?xml version="1.0" encoding="UTF-8" ?>
<gpx 
version="1.0"
creator="Some App"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xmlns:ns3="http://www.tbc.com/xmlschemas/TrackPointExtension/TBC"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.tbc.com/xmlschemas/GPX/TBC">
  <trk>
    <name>Waterspeed Activity 450bce8c-04cc-4dfc-8360-a55aade3f1c8</name>
    <trkseg>
      <trkpt lat="50.5712812557" lon="-2.4565191617">
        <ele>0</ele>
        <time>2022-10-29T12:55:52.000Z</time>
        <fix>2d</fix>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Issues in the example above include:

Notes:

GPX 1.1

The GPX 1.1 loader in MapSource is just as strict as the GPX 1.0 loader.

It does not allow misdemeanors that are allowed by BaseCamp in GPX 1.0 files:

This file is not quite GPX 1.1 compliant (namespace / schema location issues), but can be successfully imported into MapSource:

<?xml version="1.0" encoding="UTF-8" ?>
<gpx 
version="1.1"
creator="Some App"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:ns3="http://www.tbc.com/xmlschemas/TrackPointExtension/TBC"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.tbc.com/xmlschemas/GPX/TBC">
  <metadata>
    <time>2022-10-29T12:55:24.000Z</time>
  </metadata>
  <trk>
    <name>Waterspeed Activity 450bce8c-04cc-4dfc-8360-a55aade3f1c8</name>
    <trkseg>
      <trkpt lat="50.5712812557" lon="-2.4565191617">
        <ele>0</ele>
        <time>2022-10-29T12:55:52.000Z</time>
        <fix>2d</fix>
        <extensions>
          <ns3:TrackPointExtension>
            <ns3:tbc>74</ns3:tbc>
          </ns3:TrackPointExtension>
        </extensions>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Issues in the example above include:

Notes:

GPX 1.1.1 / 1.2

MapSource will only import GPX files when xmlns is "http://www.topografix.com/GPX/1/0" or "http://www.topografix.com/GPX/1/1".

This is problematic because you can’t refer to future versions of the GPX standard, even with a suitable xsi:schemaLocation defined:

At this time, I cannot see a workaround, other than converting newer formats to GPX 1.0 or 1.1 using a tool such as GPSBabel.

It should also be noted that MapSource is no longer supported by Garmin and has been superseded by BaseCamp.

The final version of MapSource was version 6.16.3 in October 2010.

Quick Recap

GPX 1.1.1 / 1.2

Files conforming to GPX 1.1.1 would be expected to have a valid GPX header:

<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="Some App"
     version="1.1.1"
     xmlns="http://www.topografix.com/GPX/1/1/1"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.topografix.com/GPX/1/1/1 http://www.topografix.com/GPX/1/1/1/gpx.xsd">

Note: Garmin software ignores xsi:schemaLocation but it is good practice to include it in the GPX file.

GPX 1.1.1 files can easily be loaded into BaseCamp, simply by changing the xmlns attribute to reference GPX 1.0:

<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="Some Appd"
     version="1.1.1"
     xmlns="http://www.topografix.com/GPX/1/0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.topografix.com/GPX/1/1/1 http://www.topografix.com/GPX/1/1/1/gpx.xsd">

Whilst this may be wrong, it is a simple way to load a GPX 1.1.1 / 1.2 file into BaseCamp without any further modifications.

In the future, Garmin can potentially support xmlns="http://www.topografix.com/GPX/1/1/1" simply by using their “relaxed” GPX import.