These flags and arguments tell GPSBabel to what I wanted the pages to show. For a rudimentary
read data in Garmin format from the COM7 serial proof-of-concept, I started with the “Visualize Your
port and write out the data in the glogbook format Exercise Routes” recipe on Particle Tree’s site
to an XML file called outputfile.xml. The -t switch tells ( makezine.com/go/particletree). Then I modified
GPSBabel that the input will be a tracklog. their JavaScript code to add clickable mile-marker
Each time the gpsbabel command is run, it pulls pins that display a pace-per-mile calculation. The
off every trackpoint that’s stored on the watch mile marker is colored blue if I took longer than 6: 30
and saves it to a single XML file. But I wanted to run a particular mile, and red if I ran faster than
to create Google Maps that showed each run that (you can individualize your own pace-per-mile
individually, not all of them at once. So, I wrote threshold in the code).
a script in Perl that parses outputfile.xml, skips I also added some functionality in the JavaScript
any trackpoint data that the script has already to recognize URL parameters that select the run
processed, and writes out multiple, separate and change the map type from regular to satellite
glogbook files for each run. or hybrid. For example, the URL that shows my
To ignore the old data, the script saves the time- run from May 10 ends with index.html?file=2006-05-
stamp from the most recent trackpoint it reads 10. 2.xml. I also used the URL parameters to create
and processes only trackpoints that were stored an RSS feed of my ten most recent runs.
since then. The JavaScript code uses the AJAX (Asynchro-

To separate the new trackpoints into different nous Java and XML) approach to retrieve the runs, I defined a threshold, $MIN_SECONDS_BETWEEN_ appropriate XML file, parse it, and then map the RUNS, which tells the script to finish writing the run trackpoint by trackpoint. The script pauses current XML file and start writing a new one when for a few milliseconds after it maps each track-there’s a sufficient time gap; in my case, I use a point and then recenters the map, which gives value of 7200, or 2 hours. The script saves XML the viewer a dynamic, animated view of the run. files for each run and names them using the date No server-side processing is necessary; all the of the run (e.g., 2006-01-15.xml). You can download animation action happens in the browser. the code from my website (see Resources). Some critical features make the process easy.

Google Earth uses an XML-based file format First, the script knows to end gracefully if the
called KML (Keyhole Markup Language), and watch isn’t cradled. That way, I can schedule
recent versions of GPSBabel have limited support the script to run every couple of hours. I simply
for this format as well. To create a KML tracklog cradle the watch when it’s convenient, knowing
from an already-saved glogbook file, you run a that the run data will be automatically uploaded
command following this format: as the watch’s battery recharges. A feature I love
about the Garmin Forerunner 201 is that you
never have to manually clear the run history; it
simply deletes the oldest set of trackpoints as
it needs more space. Both features allow me to
track my running without lifting a finger.

gpsbabel -t -i glogbook -f 2006-01-15.xml -o kml -F 2006-

01-15.xml

Once I downloaded all the new runs from my watch and ran my Perl script to convert them to both glogbook and KML file formats, I uploaded them to the server where my blog is hosted. I also copied the logs of the most recent runs to files named latest.xml and latest.kml, so my blog defaults to showing the most recent run.

 

Generating the Map Pages To publish Google Maps on my website, I first needed to obtain an API key from Google (each key permits maps to be displayed on a certain URL and all its subdirectories). Then I figured out

Resources

My running logs: dave.runningland.com/map

Running-log tutorial with downloadable code: dave.runningland.com/grunninglogs

 

Dave Mabe is the author of BlackBerry Hacks from O’Reilly Media, Inc., and lives in Chapel Hill, N.C.

References:

Archives