Garmin Training Center to KML Converter

Upload your Training Center history or course files and view them in Google Earth:




The Story

When I bought a Garmin Edge 305 GPS last year, I was a little underwhelmed by the included software (Training Center). Although it provides a lot of information, I wondered what the data would look like in Google Earth. Obviously, some time later someone at Garmin had the same idea and added a function "view in Google Earth" to Training Center. See for yourself, whose converter does the better job.

As Training Center exports to an XML format (.tcx files, a Training Center Database) and Google Earth reads another XML format (KML, the Keyhole Markup Language), it was a relatively easy job to write an XSLT converter from one to the other. It can handle your trainings ("history") and your courses. If you have a Heart Rate Monitor and/or a Cadence Sensor, this data is displayed as well. Usually, tracks are placed on the ground. If the altitude data is relevant to you (because you went flying, paragliding, parachuting or something similar), you can choose to display the tracks at the recorded height.

As a preview of the results, you can download some of my recent activities and a few courses I have planned using the appliance. This example contains data recorded on a flight from Düsseldorf to Madrid (and back) to demonstrate the altitude mode. Unfortunately, the Edge 305 has a barometric altimeter, so this is not the real altitude of the aircraft. It seems, the cabine pressure was set to 2000 meters. But you get the idea.

How to Use the Converter

Export the history or the courses from Training Center as a .tcx file. "Workouts" are not supported, as they do not contain any geographical information.

Please be patient, if you use the upload at the top of the page. History files can get quite large. You can also download the XSLT file and do the conversion yourself. You'll need an XSLT (1.0) processor, like xsltproc or Saxon. To convert a file edgehistory.tcx with xsltproc, use the following command:

xsltproc tcx2kml.xsl edgehistory.tcx > edgehistory.kml

The converter uses metric units by default. If you like to see distances and speeds in imperial units (i.e. US miles (1 mile = 1609.344 meters) and feet (1 meter = 3.2808399 feet)), add the parameter usemetric with a value of 0:

xsltproc --param usemetric 0 tcx2kml.xsl edgehistory.tcx > edgehistory.kml

The tracks are usually placed on the earth's surface, which is a good default for ground based activities. If you want to see the tracks at the recorded altitude, use the parameter altitude with a value of 1:

xsltproc --param altitude 1 tcx2kml.xsl edgehistory.tcx > edgehistory.kml

This affects all activities in the history file - which is not a big problem, as you can export single trainings from Training Center for some time now. There is still a fallback method if you want to mix ground based and real altitude tracks: In Training Center, add the text "kml.altitude=real" to the comments of the Activity.

As all tours in the example file above started from my home, and I do not want to disclose its exact location, I added a "blackbox" function, to suppress any data within a given rectengular area. You can pass four parameters to the converter, describing the minimal and maximal longitude and latitude, inside which no points shall be visible. The actual command to produce the above example file was

xsltproc --param bblonmin 8.549755280199772 --param bblonmax 8.554228784338569 --param bblatmin 52.07173192036186 --param bblatmax 52.07536129460939 tcx2kml.xsl edgehistory.tcx > edgehistory.kml

If Google Earth does not seem to display any results, click on the entry "Garmin Training Center" in the list of places. It should contain a short explanation, why the converter was not able to process your data. N.B.: Only version 2 of the Training Center Database format is supported. Please consider upgrading to the current version if you are still using an older release

If the stylesheet is not able to convert your data, please let me know. If you find this tool useful or have ideas and suggestion, please drop me a line or write a comment in my blog.

History

1.22 (2009-02-08)

Added altitude parameter to show all tracks at recorded height. Fixed rounding error.

1.19 (2008-06-10)

NeilFred Picciotto provided a patch for using imperial units. Thanks a lot!

1.18 (2007-10-23)

Added altitude mode to display tracks at the recorded height.

1.15 (2007-09-08)

Show only tracks that actually contain geographical data.

1.14 (2007-09-02)

Added check for old version of Training Center file format. It is not actually converted, though - yet.

1.13 (2007-08-28)

Fixed cut'n'paste error in calculating Lap end position.

1.12 (2007-08-28)

Added distance markers to Activities and Courses. Moved icons to my own server. Better prevention of empty coordinates elements, which make Google Earth crash.

1.11 (2007-08-25)

Fixed error when Lap contained either no start or end point. Caused Google Earth to crash.

1.10 (2007-08-22)

Added some boilerplate text.

1.9 (2007-08-19)

Added support for Courses.

1.8 (2007-08-18)

If .tcx file contains no folder, generate standard folders "Running", "Biking", "Other" and "MultiSport".

1.7 (2007-08-17)

Show tracks only, if distance is positive.

1.6 (2007-08-17)

First public release. Reflect folders found in .tcx file in generated KML file.