RunVis – Visualizing GPS Running Data from a Garmin 305.

Jan 04 2010 Published by under ActionScript, Flash, General

A while back I mentioned on twitter, and the other day here on this blog about a pet project I was playing with, visualizing the running data gathered by my Garmin 305 GPS watch while on runs. Well, here’s what I’ve got so far, for a 5 mile run I did a couple of weeks ago:

Get Adobe Flash player

Basically what I do is get the data of the Garmin device using the Garmin Training Center program that comes with the watch (updated via the web). Then I choose a workout and export it as a TCX file. This is a plain xml file with overall information about the run, and a whole bunch of track points. A single track point looks like this:

<trackpoint>
  <time>2009-12-26T12:44:43Z</time>
  <position>
    <latitudeDegrees>42.3235355</latitudeDegrees>
    <longitudeDegrees>-71.2537218</longitudeDegrees>
  </position>
  <altitudeMeters>40.5128174</altitudeMeters>
  <distanceMeters>8.9054995</distanceMeters>
  <heartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">
    <value>96</value>
  </heartRateBpm>
  <sensorState>Absent</sensorState>
</trackpoint>

As you can see, that’s pretty easy to parse. You get latitude and longitude, plus altitude, so there’s three dimensions. Here, I am showing my heart rate with the thickness of the line drawn. All you get for each track point is the distance traveled so far, but by subtracting that from the previous track point, and dividing by the time between the two, you can get the speed at any one point. This is shown by the color of the line. Red is fastest.

The map is from Open Street Maps. Using the max and min latitude and longitude, I can get a bounding box for my run, and request a map of that area as a png from that service. Load it up and rotate it around in 3D with the trail, and we’re in business. Actually, for this demo, I’ve saved out the map as a file on my own server and am loading that in. Otherwise, I’d need to proxy the map service to be able to load images from it. It works fine dynamically on the local version. Actually, I need to do a lot more tweaking on aligning and scaling the map to the trail. This example isn’t too bad, but there’s a bit of hacking around going on and it’s still not perfect. But not bad for a first try.

The whole project is less than 200 lines of timeline code in Flash CS4 (take that you elitist framework junkies!) but I’ll eventually clean it up and turn it into some classes that will be worthy of being seen by eyes other than my own.

10 responses so far. Comments will be closed after post is one year old.

  • Todd Rothe says:

    brilliant… A few months ago, after a long day of mtn bike riding, i was pondering the difficulties of visually processing my Garmin data from the strings and points it provided. Looking forward to seeing the classes.

  • That is really cool and, probably for you, really useful! Also looking forward to seeing the code.

  • finty says:

    this is very cool. can the track points be set to occur at a custom interval (i.e., to record a sprint)?

  • kp says:

    that’s up to the device. the 305 has 2 modes: one will record one data point per second. with that, it can hold something like 3.5 hours of data, if i recall that right. the other mode is “smart mode” which i guess smooths things out, so you might get a point every second, or maybe up to every 5 seconds or so. i guess if a number of points are relatively linear in terms of all the stats, it will cut out the middle ones.

  • DBM says:

    Hey Bit, that’s a great idea. I’m sure there are plenty of peeps on 12S that’d love it.

  • George Profenza says:

    Looking at this and at last year’s Spinny Draw, still can’t believe it’s 2D lineTo() calls. Damn! That’ll make them ‘framework junkies’ pick their jaw off the floor 🙂

  • […] Posted on: March 8th, 2010 RunVis – Visualizing GPS Running Data from a Garmin 305. | BIT-101 Blog http://www.bit-101.com/blog/?p=2463 […]

  • Neil says:

    Nice work KP, any chance of a few lines of code? I am interested in visualising my paragliding flights in flash. I can already do this in google earth using KML, but I would like to build an AIR app to play around with them myself.

  • Jonathan says:

    I’ve done some pretty cool stuff using the Oracle Middleware Fusion SOA architecture to populate a reporting model within OBIEE 11G (from the GPX extracts). Here I can create what I’ve branded as Athletic Intelligence around what’s really going on with my run, rides, and swims…I’ve even used it for snowboarding and it’s awesome!!! Let me know if anyone would be interested in learning more!

  • […] of people have created mashups with run data (usually map-based) and I’ve often wanted to try my hand […]