Get your tracklogs and waypoints with command-line tools to enjoy the power of scripting.
Tracklogs and waypoints are the raw material for your stories. You want to pull those out of your GPS receiver and onto your computer. There are a number of utilities to do this. Browse the Free GIS project site (http://freegis.org) for many examples of graphical and command-line tools.
Garnix is a free software program for downloading tracklogs, waypoints, and routes. It was written by Anton Helm and is available at http://homepage.ntlworld.com/anton.helm/garnix.html. I've used Garnix for more than four years, and until recently, I found its elegance of interface and features to be compelling. Lately I've also been using GPSBabel [Hack #51]
Command-line tools give you the power to chain together functions and automate tasks. For example, I have a script that will import my tracklogs, clean up the format, create an animation of the tracklog [Hack #56] , and then upload that animation to my home server.
It was hard for me to learn the command-line tools and string them together in a script, but now my post-trip workflow is accomplished more quickly than trying to do the same thing with individual GUI tools. This is an example of a productivity paradox. Ease of use and ease of learning don't always go together; learning often carries the price of short-term inefficiency.
A word on post-trip workflow: I've been known to crawl into a hotel at 1:00 A.M., only to open two laptops in order to import photos, download tracklogs and waypoints, burn CD copies of my notes and pictures, import my voice-recorder annotations, and upload the whole mess to a web site. I'm not saying that this is the only, best, or right way to live one's life. But it is how I live mine, and since it is how I live my life, I am interested in ways to speed up my processing.
5.5.1. Garnix for Linux, Windows, or DOS
The installation of Garnix is basically the same for Linux or Windows/DOS. Download the appropriate binary file and uncompress it into a new directory. For the Linux version, you need to make the program executable with chmod +x garnix. Source code is also available, as well as an interesting document that reverse-engineers the Garmin protocol.
To check that it is working, make sure you have the GPS set in Garmin protocol mode and connect the GPS to your serial port. Under Linux, you may need to be root, or run sudo, to have access to your serial port.
[rich@testingrange garnix]$ sudo ./garnix Password: Device ID: GPS III+ Software Version 2.03 Device Info 1: VERBMAP Americas Highway Land Data 1.00 Device Time: 12:32:28-2004/08/11 Current Position (WGS84): Latitude 38deg 40min 47.98sec Longitude -123deg 17min 3.59sec
If you can't remember an option, type garnix -h for a terse help screen.
Garnix has three different display formats: degrees-minutes-seconds (DMS) with symbols, DMS with abbreviations, or Waypoint Plus format.
Here's how to apply the three formats to waypoints.
Waypoints in DMS with abbreviations ("text" mode):
$ garnix -w -x -f myway.txt
38deg 24min 12.32sec -122deg 49min 6.76sec 0.0 WGS84 OREILY "CRTD 19:34 31-AUG-00" [wpt_dot N];
Waypoints in DMS with symbols:
$ garnix -w -s -f myway.txt
38 24' 12.32" -122 49' 6.76" 0.0 WGS84 OREILY "CRTD 19:34 31-AUG-00" [wpt_dot N];
Waypoints in Waypoint Plus format:
$ garnix -w -y -f myway.txt
WP,D,OREILY, 38.40342,-122.81854,12/31/1969,16:00:00,CRTD 19:34 31-AUG-00
Garnix configuration is set in the file garnix.cfg. This is where you set your serial port (under Linux, /dev/ttyS0 is the first serial port), and if you add deg_min_sec; then imports will use the DMS format by default. The big win for the Waypoint Plus format is that Lat, Long is displayed in decimal degrees.
Garnix Waypoint DMS format looks like this (from the file garnix.txt):
The important fields are , , (not available in older units), the waypoint name (), and the waypoint comment (). If you don't enter another comment in the GPS unit, then will be the date and time the waypoint was created. In the previous example, I created, or updated, that waypoint at 7:34 P.M. on August 31, 2000.
Garnix tracklogs follow the same general pattern as waypoints.
Tracklogs in DMS with abbreviations ("text" mode):
$ garnix -t -x -f mytrack.txt
42deg 11min 47.75sec -122deg 42min 57.36sec 0.0 WGS84 00:00:00-1970/01/01 ; 42deg 10min 5.79sec -122deg 39min 30.57sec 0.0 WGS84 00:00:00-1970/01/01 ; ... 38deg 27min 51.70sec -122deg 39min 53.47sec 0.0 WGS84 07:38:45-2004/08/07 ; 38deg 27min 51.84sec -122deg 39min 53.84sec 0.0 WGS84 07:38:47-2004/08/07 ;
Tracklogs in DMS with symbols:
$ garnix -t -s -f mytrack.txt
42 11' 47.75" -122 42' 57.36" 0.0 WGS84 00:00:00-1970/01/01 ; 42 10' 5.79" -122 39' 30.57" 0.0 WGS84 00:00:00-1970/01/01 ; .. 38 27' 51.70" -122 39' 53.47" 0.0 WGS84 07:38:45-2004/08/07 ; 38 27' 51.84" -122 39' 53.84" 0.0 WGS84 07:38:47-2004/08/07 ;
Garnix Tracklog DMS format (from the file garnix.txt):
These  and  values at the end of each line are interesting. Unlike some of the free programs, Garnix includes the track segment flag. What if you are on a trip and the GPS runs out of batteries, powers down, and stops saving the tracklog? Ten minutes later, you put new batteries in and you are good to go. But now you have a gap in your tracklog. The GPS is capable of determining that this has happened, so when you power back up, the first track point is marked with the start of segment flag, shown as , so you can decide what you want to do with the data. Sometimes it is better to have no data, rather than bad data.
5.5.2. An Important Lesson
We get into ruts in the ways in which we use tools. Sometimes it takes the non-maskable interrupt of life to jar us from our ruts. I have used Garnix for over four years and have always been annoyed by the "feature" of loading coordinates in DMS, instead of decimal degrees. I have written way too many little Perl scripts to munge the data into my preferred format, and even had to do the same in [Hack #11] . And, now, in the process of actually looking at the Garnix documentation and trying all of the options, I realize that the Waypoint Plus format appears to have everything I need, without the annoyance of the more-difficult-to-parse DMS format.
The lesson is that we are all neophytes in the world, and periodically glancing at the documentation for our core tools, rather than obsessively reading Slashdot, offers great rewards.
5.5.3. See Also
Another command-line GPS interface.
Described in [Hack #51] .
A Python module to connect to a Garmin GPS.
Freegis.org has a category for GPS software.
Mapping Your Life
Mapping Your Neighborhood
Mapping Your World
Mapping (on) the Web
Mapping with Gadgets
Mapping on Your Desktop
Names and Places
Building the Geospatial Web
Mapping with Other People