Tuesday, July 8, 2008

GPS in Ubuntu

When I started running more often, I decided to keep a log of my runs. I've found it to be helpful and mostly encouraging. To map the runs I do and get some idea of distance and such, I use mapmyrun (but only until I roll my own...). However, when running on trails, you're pretty much just guessing where points are. So I consider myself lucky enough to have a friend with a little portable GPS unit that I was able to borrow (thanks Sean). I took this on my favorite parts of the Rivanna Trail, here in Charlottesville. I had been worried that it'd be difficult to get the information off the unit, but it was really easy.

The unit is a Garmin etrex Venture Cx, and I am using Ubuntu 8.04 Hardy Heron. So here goes
  1. Install the gpsbabel package, with "sudo apt-get install gpsbabel".
  2. Plug the unit in via usb cable, and turn it on. I'm inside so it couldn't get a strong satellite reading, and complained about that after a few minutes, but I told it to just work without gps, so that it'd remain on.
  3. I first tried "gpsbabel -i garmin -f usb: -o gpx -F file.gpx", but it complained at me. Somewhere online I saw some indication that you had to be root, so 'sudo' that command, and you get the waypoints off of the unit. That was easy.
  4. What I was most interested in was the 'Tracks' it had stored. While probably overkill, the command "sudo gpsbabel -t -r -w -i garmin -f usb: -o gpx -F file.gpx" pulled the tracks (and waypoints, and probably more, I haven't looked too closely yet) off the unit.
So there you have it. I now have a nice looking xml file with some geodata in it. Now I just gotta get my mapping software to a point where I can use this information...


ana said...

Hummm I did install gpsbabel using sudo apt-get install gpsbabel... but i don't get it how to use the program and insert geocaching data or waypoints into the gps...

sumidiot said...

Hmm. I didn't try writing any data to the gps, just pulling it off the gps. Perhaps gpsbabel.org can help out? Either the docs or the wiki?

bamboozle said...

maybe you should export your data directly in "kml" format (to use in google earth/maps). just change argument of the "-o" option to "-o kml" (and the extension of the output file).

@ ana: just exchange the arguments of "-i" and "-o" options; and the arguments of options "-f" and "-F". "-i" is input source, "-f" is input "file", "-o" is output source and "-F" is output "file".


sumidiot said...

Thanks for the tips @bamboozle!