GPX, TCX, FIT: How to choose the best file extension for sport activity transfer ?

Charles Anssens
Decathlon Digital
Published in
6 min readJun 17, 2021

.gpx .tcx .fit, all these file extensions are used to transfer by file a sport activity (or a track, a workout).
All sport applications allow you to export or import by these standards your sport activities.
The different files will generally provide context data : the name of the activity, the startime, the location data (the GPS track) with more or less data : pace , temperature, heart rate…
Primarily these formats were designed for the outdoor GPS watches but slightly the market evolved to the whole sport practice including indoor training, so the newest formats have a better support of all practices.

We will describe the capabilities and pros and cons of each solution.

GPX : Global Positioning XML

  • Publisher : Topografix https://www.topografix.com/gpx.asp
  • Date of initial release : 2002
  • Usage : GPS trackpoint
  • Who use it : Applications of navigation (routes, waypoints…), Strava, Garmin, Everybody…
  • Pro (+) : Standard and open format, still the reference today.
  • Con (-) : File size, restriction on location point and extensions information
    No data about the sport practised

TCX : Training Center XML

  • Publisher : Garmin
  • Date of initial release : 2007
  • Usage : GPS, in-door activity (Heart rate, etc.)
  • Who use it: Garmin training center, Strava, Polar …
  • Pro (+): No apparent licensing restrictions (XML schemas freely available). As it is an xml based file it is possible to edit it with a simple text editor. Good evolution of GPX more focused on sport (in-door activity, sport)
  • Con (-): Seems to be used extensively by garmin products but not by their competitors. Data about the sport practised limited

FIT: Flexible and Interoperable Data Transfer

  • Publisher: Garmin (Ant+) https://developer.garmin.com/fit/file-types/
  • Date of initial release : 2010
  • Usage: Activity, Weight, Route, Workout, Devices settings…
  • Who use it: Garmin, Polar, Coros, Suunto, WahooFitness, Strava…
  • Pro (+): Compact, extensible, various type of data, multi-sport
  • Con (-): You must implement the FIT protocol to read and write files
    You have to join the Fit consortium to create fit file for your brand

We will now take a deeper look into each file extension’s functionalities

GPX

GPX ( GPS eXchange Format) is a data format for exchanging GPS data between programs, and for sharing GPS data with other users like itinerary (hiking, cycling… ).

The file format is XML and it’s “readable” so users can easily read and modify it.

Basically file is composed of :

  • Header (version/ creator …),
  • metadata (name / time),
  • trk: represents an ordered list of points describing a path.
  • Wpt: represents a waypoint, point of interest, or named feature on a map.
  • rteType: represents route — an ordered list of waypoints representing a series of turning points leading to a destination.
  • Extensions: You can add extensions to the GPX by adding your own elements from another schema here (current hr, cadency, temperatures)
  • trksegType: A Track Segment holds a list of Track Points which are logically connected in order. To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new Track Segment for each continuous span of track data.

Constraints:

GPX format does not let you push information without any location data. That’s means that every sport session done without GPS can not use this file format (ex: a pilates session with my Apple watch who saved my HR)

TCX

TCX for Training Center XML is a data container written in XML. It was developed by Garmin in 2007. The main goal of this format is to extend the capabilities of the GPX format (for its GPS data storing abilities) by adding more data such as heart rate and cadence.

There are two versions of this format with their own XML schemas hosted by garmin, here are some of them:

The TCX format is also more “sport activity-centric”. This means that the activity is not a GPS point track, but the GPS track is a component of the activity so those GPSpoints contain their heart rates, etc… at the given time they were recorded.

The TCX also includes a feature for non map based devices with a “turn guidance” which allows users to get direction arrows displayed on their gear.

FIT

FIT (Flexible and Interoperable data Transfer) protocol is a format designed specifically for the storing and sharing of data that originates from sport, fitness and health devices.

Fit format allows you to store information such as sensor data, course points, workout instructions, device settings, etc. This information is embedded in messages which are serialized and compiled to create a FIT file.

Fit file is a binary file composed of: File Header, Message Definitions, Messages, and a 2-byte CRC

To create or manipulate Fit files, you can be focused on the messages and the other components may be handled by your SDK.

File Id message is the first message in the file. It describes the type of file (Activity, Workout, Course) and the producer of the file (manufacturer, device, serial number…).

Type of file:

  • Activity (4) Records sensor data and events from active sessions
  • Workout (5) Describes a structured activity that can be designed on a computer and transferred to a display device to guide a user through the activity
  • Course (6) Courses can be used to assist with on- and off-road navigation, to provide turn by turn directions, or with virtual training applications to simulate real-world activities.

Other types : Settings, Blood pressure, weight…

For an activity type, some messages are required for an Activity file:

  • File Id
  • Activity (Summary, timestamp, number of sessions)
  • Session (The summary data about the practice, it could have multiple sessions for multisport for example)
  • Lap (Lap messages represent laps or intervals within the session)
  • Record (Record messages is where you can find the moment-by-moment GPS coordinate, speed, distance, heart rate, power, etc. )
Composition of an activity

Source: https://developer.garmin.com/fit/cookbook/decoding-activity-files/

Architecture of FIT file with the content of a message

source: https://developer.garmin.com/fit/protocol/

The advantages of the FIT format are the various usage, the completeness and the compactness of the file. The constraint, it is not human readable as a XML file.

Conclusion

The Fit format brings a lot of enhancements compared to GPX and TCX formats.

Garmin, Strava, Polar, Suunto and more now use Fit format, which is now a reference in the sport tech industry and could be the new standard for sport activity portability.

At DECATHLON, we are now involved to support the FIT files. For our API Sports Tracking Data ( doc: https://developers.decathlon.com/products/sports-tracking-data/docs ), we now support FIT files in input and output.

Get an activity in FIT file:

curl -X GET \
https://api.decathlon.net/sportstrackingdata/v2/activities/{ACTIVITY_TOKEN}.fit \
-H 'Authorization: Bearer {your bearer}' \
-H 'Accept: application/octet-stream' \
-H 'x-api-key: {your api key}'

Post an activity by FIT file:

curl -X POST \
https://api.decathlon.net/sportstrackingdata/v2/activities \
-H 'Authorization: Bearer {your bearer}' \
-H 'Content-Type: application/octet-stream' \
-H 'x-api-key: {your api key}' \
–data-binary 'your_fit_file'

More information: https://github.com/Decathlon/sports-tracking-data-documentation/blob/master/docs/042-anatonomy-of-activity.md

Writers : Charles Anssens, Thomas Dessaux, Kevin Forget

DECATHLON Sports Tracking Data API: https://developers.decathlon.com/products/sports-tracking-data

We are hiring!

Skills transformation will never stop, and to reach the top we need the best talents: JOIN US!

Follow https://joinus.decathlon.ca/en/annonces to see the different exciting opportunities !

Follow our latest posts on Twitter and LinkedIn and discover our sport tech initiatives like open APIs on our developers website 🚀

--

--