Tuesday, March 4, 2008

GPS Fun(?) on Linux

I have a Magellan SporTrak Map GPS that I won as a door prize a few years back. Every now and then I dig it out of a drawer and play with it. I bought a new bike this week, you see, and I downloaded some routes from MapMyRide that I wanted to put on the GPS so I would have a route to follow while biking. Should be pretty straightforward, I thought.

MapMyRide offers downloads of routes in gpx format, which I've run into before while playing with this gps stuff. Cool. So I downloaded the files and did a quick search for Linux GPS software. Unfortunately it still looks like gpsman is still really the only software out there that does what I need (please, please correct me if I'm wrong). gpsman is a piece of ugly tcl/tk software that does a fine job of connecting to my Magellan and allowing me to download and upload track data using the gpx file format. The interface is awful. It opens up three windows that aren't really labeled as to what they are, and offers all kinds of confusing buttons. And did I mention it's ugly? Once you get the hang of it, it does work fine though.

Actually, it did work fine, until I told it to open the gpx file from MapMyRide. It gave me some kind of error with what I'm guessing was a tcl stack trace. It said something about time or date, so I opened up the gpx file. At this point I'm thankful for xml. It was pretty easy to compare the MapMyRide gpx file with one that gpsman had generated from my gps track data and see that the big difference between the two was that the MapMyRide one didn't have an <el> or a <time> element with each <trkpt> element like the gpsman file did1. If I'm reading the gpx schema correctly, those are optional elements, so I think this is gpsman's fault.

To work around this, I just grabbed the two missing elements from my gpsman generated gpx file and pasted them into my MapMyRide gpx file. After that gpsman could "import" the gpx file and then put the track onto my gps.

Now I can see the track as a nice little dotted line on my gps map view and I'll let you know how the bike ride goes.

Footnotes

1 Actually, I ran it through gpsbabel like this first, hoping that would fix the problem:

gpsbabel -i gpx -o gpx,gpxver=1.0 original.gpx original-1.0.gpx

It didn't fix the problem, but it least it added line breaks and made the xml easier to read.

1 comment:

Matt Green said...

The el and time optional elements are handled differently by different GPS units, for example my Garmin eTrex will store some tracks with them and others without as an effort to save memory space.

I haven't tried uploading tracks without back into so I'll give it a try...

As for GPSBabel, it should be able to send files to your GPS via the serial port.

The -o option not only supports outputting to files but to devices, look at the man page for gpsbabel but I think something like "-o magellan -F /dev/tty0" where tty0 is your serial port.

I have used this to send to my Garmin.

Hope that helps?
Matt