Rob Blackwell home resumé archive

Convert GPX to GeoRSS using XSLT

24 June 2007

I have a Garmin eTrex Legend handheld GPS. It’s been in the drawer for the last year or more and I’ve lost the software and manuals.

I need to record a track log for an upcoming project, export the track log to the PC and then visualise the route using Microsoft Virtual Earth. This turned into an interesting Sunday afternoon hack ..

1. eTrex instructions easily available from the Garmin site – why cant all hardware manufacturers do this?

2. EasyGPS comes to the rescue for transferring the tracklog – It’s easy to install and set up and within a matter of minutes I have a GPX file (GPS eXchange format).

3. I need to turn GPX into GeoRSS. Both are XML formats, so an XSLT stylesheet comes to the rescue.

4. Apply the stylesheet to the GPX file. On a UNIX box or under Windows Cygwin, you can use xsltproc.

% xsltproc gpx2georss.xsl mytrack.gpx > out.xml

I also discovered that you can do it on a Windows command line with the MSXSLT parser available here.

d:> msxsl.exe mytrack.gpx gpx2georss.xsl > out.xml

5. Take the out.xml file and plug it into the Virtual Earth control using the modified GeoRSS sample, available from the Virtual Earth Interactive SDK here.

Here are some dog walks as proof that it works …