RunVis – Visualizing GPS Running Data from a Garmin 305.

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:

[kml_flashembed publishmethod=”static” fversion=”10.0.0″ movie=”http://www.bit-101.com/RunVis/runvis.swf” width=”800″ height=”800″ targetclass=”flashmovie” base=”http://www.bit-101.com/RunVis/”]

Get Adobe Flash player

[/kml_flashembed]

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:

[xml] 42.3235355
-71.2537218
40.5128174
8.9054995

96

Absent
[/xml]

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.

This entry was posted in ActionScript, Flash, General. Bookmark the permalink.

8 Responses to RunVis – Visualizing GPS Running Data from a Garmin 305.

  1. 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.

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

  3. finty says:

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

  4. 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.

  5. DBM says:

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

  6. 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 🙂

  7. 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.

  8. 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!

Leave a Reply