Posted by: Ian | September 10, 2011

GPX, TCX, BikeRouteToaster and the Black Rat

Tomorrow I’m planning to do the 100 mile North Devon Ride organised by Black Rat. In preparation, I’ve created a course for it in BikeRouteToaster, which you can find here. The organisers have posted a Garmin route but this has the flaws that (a) it doesn’t quite map the actual course since they’ve re-routed it a bit and (b) it starts and ends at the wrong place.

I’ve written previously about how to load a BRT route such as my one here onto a Garmin Edge 800. Recently, in comments someone asked whether the TCX file format that I use is superior to the more commonly used GPX format. So here I’ll explain the differences, and why I use the former.

If you save my Black Rat BRT route to a GPX file and open it in a text editor (I use Text Wrangler, Word would be fine) you can see that it’s an XML file with the majority of blocks being trackpoints that look like this:

<trkpt lat=”51.1674024187947″ lon=”-3.95222606125772″>

   <ele> 225 </ele>

   <time> 2011-09-10T06:25:29Z </time>

   <course> 108.066479794641 </course>

   <speed> 8.31949972349129 </speed>

</trkpt>

Before thinking about what these do, take a step back and consider how the blue route line that’s drawn on the BRT map is going to make it onto the Garmin. For example, here’s the section where the course drops into Lynton and then climbs out up Countisbury Hill:

Clearly, the blue line itself is not saved as a JPG or any other picture format and passed from BRT to the Garmin as an image. Instead, it is captured as a lot of separate points. Each of the track points in the GPX file specifies one of these. The first line of the trackpoint gives the latitude and longitude, which is all that the Garmin needs to recreate the route line on its own maps. In addition, BRT supplies:

  • the elevation (225 metres in the example given), so that the Garmin can draw those very handy course profiles;
  • the time it forecasts I’ll get there (6 hours, 25 mins after the start here – note that this trackpoint is from much further along the course than Lynton!), calculated using the parameters you set in BRT;
  • the speed (given here in pure SI units as 8.32 metres per second), again based upon the BRT settings for speed on the flat and up hills;
  • and the course, which is a heading in degrees (108 here).

The GPX file is barely anything other than some 3,000 of these trackpoints – one for every 50 metres or so of the course.

Now, compare the TCX file produced by BRT from the same course. Again, it’s XML with the majority of the file comprising a bunch of trackpoints; here’s the one that corresponds to the same point as that given above:

<Trackpoint> 

   <Time> 2011-09-10T06:25:29Z </Time> 

   <Position>

      <LatitudeDegrees> 51.167402 </LatitudeDegrees>

      <LongitudeDegrees> -3.952226 </LongitudeDegrees>

   </Position> 

   <AltitudeMeters> 225 </AltitudeMeters> 

   <DistanceMeters> 134410.660852158 </DistanceMeters>

   <SensorState> Absent </SensorState> 

</Trackpoint>

Latitude, longitude, altitude and time are the same. The TCX trackpoint does not have Speed and Course but it does encode Distance (134,410 metres) and “SensorState”, which is always “Absent”. This is irrelevant. What does matter is that after all of the trackpoints the TCX file also has a collection of “CoursePoints”. These look like this:

<CoursePoint>

   <Name> Turn Right </Name>

   <Time> 2011-09-10T03:24:27Z </Time>

   <Position>

      <LatitudeDegrees> 51.203898 </LatitudeDegrees>

      <LongitudeDegrees> -3.639077 </LongitudeDegrees>

   </Position>

   <PointType> Right </PointType>

</CoursePoint>

These tell you what to do at junctions. Other than in the TCX file, you see these at the following times:

1. On BRT they appear as the red Course Points on the map. For example, there are seven of these on the map snippet above. As you plot your course in BRT one of the neat things that it does is figure out where the road junctions are and what you have to do there – the choices are “Turn Left”, “Turn Right” or “Straight”. This does not depend upon you clicking on the junctions when you create the course and the red course points do not show where you clicked. You can try this for yourself: create a new route an then watch as the course points appear at junctions in red.

2. Also on BRT, each course point appears as an entry on the Cue Sheet. Here, in addition to Turn Left, Turn Right or Straight you get map context and further information. Here’s an example from the cue sheet around Lynton, corresponding to part of the map above:

Again, if you try this for yourself you can see these cue appearing in BRT on the Cue Sheet as you make a new route, with one cue appearing for every new red course point.

3. In Garmin Training Center if you upload the course from the TCX you get the list of cues but without the extra text:

Since the extra text on the Cue Sheet such as “Slight right onto Castle Hill” doesn’t get into the TCX file, it can’t make it into Training Center or onto the bike computer. But the coordinates and the instruction (e.g. “Turn right”) are, of course, there.

4. On the Garmin Edge 800 you get the same list of directions along with the distance and (accurately) estimated time to get there, as described in my earlier blog.

5. Also as described in my earlier blog, the instructions (such as “Turn right”) flash up on the Garmin Edge 800 screen when you reach each relevant course point.

My central observation here is that these course points are not in the GPX file! Other software such as the Ordance Survey GetAMap program, can encode directions as Waypoints and write this into the GPX XML but so far I haven’t managed to transfer these to Garmin directions (but, to be fair, I haven’t really tried).

Tomorrow I’ll have my course loaded on my 800 from BRT via TCX and have my directions and route profile available to help me make it around a route that is certain to be uncomfortably hard.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: