Activity Tracking Filetypes
I recently found myself trying to parse raw data from my GPS-tracking watch, and I found that I could export the data in many different filetypes. Not knowing which type I needed, I decided to export all of them and learn the differences for myself. These formats are frequently used to share data across platforms such as Garmin, Suunto, Strava, TrainingPeaks, MapMyRun, Coros, Nike, and even Google Maps.
File Types
The types of files I could export from my Coros app were:
.fit
.gpx
.kml
.tcx
.csv
File Comparisons
I exported and compared the file types for a slow, steep, medium-long run that I did while volunteering at Portola Redwoods State Park in California. Here is a summary of my findings:
File Type | Size (MB) | Licensed Use Only (Proprietary) | Human-Readable | GPS Data | Standardized Biometric Data | Extensible |
---|---|---|---|---|---|---|
.csv | 0.004 | ✓ | ||||
.fit | 0.320 | ✓ | ✓ | ✓ | ✓ | |
.gpx | 2.8 | ✓ | ✓ | ✓ | ||
.tcx | 4.8 | ✓ | ✓ | ✓ | ✓ | |
.kml | 5.4 | ✓ | ✓ | ✓ |
CSV
Sample CSV Entry
"Split","Time","Moving Time","Distance","Elevation Gain","Elev Loss","Avg Pace","Avg Moving Paces","Best Pace","Avg Run Cadence","Max Run Cadence","Avg Stride Length","Avg HR","Max HR","Avg Temperature","Calories"
"1","02:54:17 ","02:54:01 ","21.94","800","801","00:07:57 ","00:07:56 ","00:00:00 ","81","105","92","--","--","21","113"
"Summary","02:54:17 ","02:54:01 ","21.94","800","801","00:07:57 ","00:07:56 ","00:00:00 ","81","105","88","--","--","21","113"
While the .csv
format is smallest, it contains the smallest amount of data. It only includes information about laps and metrics for those laps. So, in my 1-lap .csv
file, there are 3 lines of data. I can see things like my average pace, distance, elevation gain, etc. I can’t see information about when or where the activity took place.
The .csv
format contains no information whatsoever related to GPS coordinates for the activity
If all you’re looking for is a simple description of a workout, like the amount of time, average pace, average HR, distance covered, etc, then the .csv
file will suite those needs.
FIT
Note: You won’t be able to read this file unless you process it with a decoder
The .fit
file is the smallest file that contains a full set of data for the workout, including precision timestamps, gps data, etc. It is probably the smallest format that could be used to “validate” an activity. However, there is a huge pitfall - FIT files are encoded, meaning they are not human-readable, and the format is defined, owned, and maintained by Garmin. When you use .fit
you are agreeing to this license. Garmin maintains that any derivations of the .fit
protocol belong to Garmin.
What this means to me, as an open-source-contributing developer, is: “USE AT YOUR OWN RISK. YOUR ABILITY TO USE FIT MAY BE REVOKED AT ANY TIME. GARMIN OWNS EVERYTHING THAT PERFORMS FIT ENCODING/DECODING. YOU WILL NOT BE ABLE TO USE FIT TO BUILD A SERVICE THAT COMPETES WITH GARMIN PRODUCTS. GARMIN HOLDS THE KEYS TO THE FIT KINGDOM”
It seems like .fit
was developed by Garmin for the purpose of cross-platform data sharing. There are a few libraries that support decoding of .fit
files in different languages (i.e. python, Go, Haskell). Since .fit
isn’t an open specification, and Garmin’s license explicitly states that they own all derivations of the FIT encoding/decoding source code, any products that use these libraries will technically belong to Garmin.
If you work with .fit
files, and you don’t work for Garmin, you run the risk of having your .fit
ecosystem shut off in the future. Though Garmin probably sees value in maintaining a consistent, sharable, small-size format that becomes widely adopted, there is no guarantee of the format remaining a viable cross-platform sharing option for devices and/or software that is not made by Garmin.
GPX
Sample GPX Point Entry
<trkpt lat="37.252433" lon="-122.216745">
<ele>131.000000</ele>
<time>2020-10-10T18:28:15Z</time>
<extensions>
<heartrate>4294967295</heartrate>
<distance>132.000000</distance>
<cadence>82</cadence>
</extensions>
</trkpt>
GPX, the GPS Exchange Format is a long-standing open standard for the interchange of GPS data. GPX is defined via XML, a long-standing and well-known markup standard (HTML, which contains the content of web pages, is also defined via XML). GPX schemas are versioned and publicly available, and the last version has been in use since 2004. Needless to say, this data format is well-defined and well-used.
While the format specification focuses on GPS track points (timestamps with precise coordinates), the extensions
type allows for infinite extensibility. The example file I provided includes data that my watch measured for cadence and heart rate (wrist-based HR, so it’s very inaccurate, but still there). The “core” spec-defined datapoints that are recorded in my activity include track points (lat & lon), elevation, and a timestamp of each measurement.
TCX
Sample TCX Point Entry
<Trackpoint>
<Time>2020-10-10T18:27:35Z</Time>
<Position>
<LatitudeDegrees>37.252345</LatitudeDegrees>
<LongitudeDegrees>-122.217635</LongitudeDegrees>
</Position>
<AltitudeMeters>129.000000</AltitudeMeters>
<DistanceMeters>31.000000</DistanceMeters>
<Cadence>87</Cadence>
<Extensions>
<Speed>11.930000</Speed>
</Extensions>
</Trackpoint>
TCX, or Training Center XML, is another XML-defined format. Like the .fit
format, Garmin created the .tcx
format but with a key difference: the schema is versioned and publicly maintained. Garmin hosts the schema here. It contains all the information of a .gpx
file, plus a few additional features: support for multi-sport activities, support for course markings (aid stations, transition points, etc).
KML
Sample KML Point Entry
<Placemark>
<TimeSpan>
<begin>2020-10-10T21:21:30Z</begin>
<end>2020-10-10T21:21:30Z</end>
</TimeSpan>
<Style>
<IconStyle>
<color>FF00FFFF</color>
<scale>1.000000</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png</href>
</Icon>
</IconStyle>
</Style>
<Point>
<coordinates>-122.219147,37.252062, 126.000000</coordinates>
</Point>
</Placemark>
KML stands for Keyhold Markup Language and it was created to display geographic data in a specialized browser such as Google Earth. It contains top-level support for time and coordinate data, but not much else when it comes to activity-specific metrics. It does not contained defined fields for any biometric data, though technically it is extensible.
If you’re looking to aggregate maps of activities and overlay them in some kind of map interface, the .kml
format might suite your needs. But otherwise, it is probably the least useful of the formats that include GPS coordinate data. It has the largest file size and the least relevant data to analyze performance metrics.
Summary
When it comes down to personal preferences to export my data, my thoughts are:
- If all you’re looking to do is maintain a very simple training log,
.csv
fits the bill. - I would default to using the GPX or TCX file formats when exporting data. Even if Garmin stops maintaining the TCX definition, the files will remain useful because they are written in XML. TCX contains more top-level support for data such as heart rate and cadence, whereas GPX does not (but this data will often be available via custom extensions, as in my example above).
- I would steer clear of the
.fit
format. It would be great if Garmin made it an open standard with a permissive license, but this is not the case today. This is a shame, because the format contains the most utility of the bunch - a small file size with the most amount of relevant workout data. - KML seems useful only if you’re using the info for purely graphical purposes, overlaying GPS tracks and whatnot.
There you have it! I hope this post provided some useful information. Feel free to share via the social links below.