Invocation

If you're using GPSBabel, you will need to know how to do at least two things: read data from a file, and write it to another file. There are four basic options you need to know to do those things:

CommandMeaning
-i format Set input format
-f filename Read file
-o format Set output format
-F filename Write output file

Important

Case matters. Notably -f (lowercase) sets the input file. -F (uppercase) sets the output file.

The format parameters in the above list refer to the names of formats or file types supported by GPSBabel.

gpsbabel -?

will always show you the supported file types. In this document, the various supported formats are listed in Chapter 3, The Formats . The name that you would use on the command line follows the format name in parentheses.

Options are always processed in order from left to right. In practical terms, this means that things you want to read should appear in the command before things you want to write. This sometimes surprises new users as adding options to turn on debugging at the end, for example, doesn't work as the debugging is turned on after all the interesting work is done. The reason for this strict ordering becomes more apparent once you learn about mixing formats and filters.

The filename parameters specify the name of a file to be read or written.

To use GPSBabel in its simplest form, just tell it what you're reading, where to read it from, what you're writing, and what to write it to. For example:

gpsbabel -i geo -f /tmp/geocaching.loc -o gpx -F /tmp/geocaching.gpx

tells it to read the file /tmp/geocaching.loc in geocaching.com format and create a new file /tmp/geocaching.gpx in GPX format. It's important to note that the names have nothing to do with the formats actually used.

This command will read from a Magellan unit attached to the first serial port on a Linux system (device names will vary on other OSes; typically COMx: on Windows) and write them as a geocaching loc file.

Example 2.1. Command showing Linux download from Magellan serial and writing to .loc file

gpsbabel -i magellan -f /dev/ttyS0 -o geo -F mag.loc


This second command does the same on Microsoft Windows.

Example 2.2. Command showing Windows download from Magellan serial and writing to .loc file

gpsbabel -i magellan -f com1 -o geo -F mag.loc


Optionally, you may specify -s in any command line. This causes the program to ignore any "short" names that may be present in the source data format and synthesize one from the long name. This is particularly useful if you're writing to a target format that isn't the lowest common denominator but the source data was written for the lowest common denominator. This is useful for writing data from geocaching.com to a GPS so my waypoints have "real" names instead of the 'GC1234' ones that are optimized for receivers of the lowest common denominator. A geocacher using Linux with a Magellan receiver may thus find commands like this useful.

gpsbabel -s -i geo -f geocaching.loc -o magellan -F /dev/ttyS0

His counterpart on Windows will find this equivalent

gpsbabel -s -i geo -f geocaching.loc -o magellan -F com1