DE:Using GPSBabel from the command line
| Dieser Artikel ist eine deutsche Übersetzung des englischsprachigem Originals aber der Inhalt scheint nicht aktuell und/oder vollständig zu sein! |
This page details how to call the GPSBabel program from the command line. As with many powerful tools, the command line is where much of the interesting functionality lives. The trade-off is a small learning curve. For GUI alternatives, see GPSBabel or making GPX Tracks.
Contents |
Basis-Kommando
Das Basis Kommando zum Aufruf von GPSBabel sieht so aus:
gpsbabel [options] -i INTYPE -f INFILE -o OUTTYPE -F OUTFILE
wobei ‘INTYPE’ und 'OUTTYPE' die Formate sind, die GPSBabel beherrscht, und 'INFILE' und ‘OUTFILE’ sind die Pfade der Daten. That location can be either a file or the name of a physical device. For example a serial port may appear as 'com1' under Windows or '/dev/ttyS0' under Linux.
Let's say you have latitude, longitude, and waypoint name in the file 'way.csv'
40.70175, -103.68998, First Waypoint 39.28553, -123.79357, Another point 42.49638, -108.72995, And a third
To convert these to the GPX format file way.gpx:
gpsbabel -i csv -f way.csv -o gpx -F way.gpx
Deconstructing the command line: '-i csv' using the comma separated value INTYPE. '-f way.csv' (note that is a lower case f) specifies the name of the input file (or the name of the input serial port). '-o gpx' specifies the output is GPX format. '-F way.gpx' (capital F) provides the name of the output file (or output serial port).
Reading waypoints from a GPS
GPSBabel directly supports Garmin, Magellan and Wintec GPS units. Connect your GPS to your serial port or USB port depending on your device type (for connecting serial receivers to USB ports see GPS Serial to USB). A Garmin serial GPS is specified -i garmin while a Magellan is -i magellan. Use the -f and -F parameters to specify the serial port for your GPS. Use -f when you read from the GPS and -F to write to the GPS. (NB, if the following commands do not appear to work on the Garmin units, check that the Interface Setting on the unit is set to "GARMIN" or "GARMIN DGPS").
You can get more information by running gpsbabel -?, and by reading the README file. Here are some examples:
To read waypoints from a Garmin GPS and write them out to the GPX format file named 'waypoint.gpx.'
Windows
Under Windows assume the GPS is attached to the first serial port:
gpsbabel -i garmin -f com1 -o gpx -F waypoint.gpx
That sets the input type to the Garmin serial protocol to read data from the serial port and write it to a GPX format file named waypoint.gpx.
If instead the device is connected to the USB port:
gpsbabel -i garmin -f usb: -o gpx -F waypoint.gpx
Linux
Assume the GPS receiver is attached to the first serial port. (Need to run as a user who has rights to read the serial port, so some systems may require the program to run as root or with sudo.)
gpsbabel -i garmin -f /dev/ttyS0 -o gpx -F waypoint.gpx
If the device is connected to the USB port, try /dev/ttyUSB0 or usb:
gpsbabel -i garmin -f /dev/ttyUSB0 -o gpx -F waypoint.gpx #or gpsbabel -i garmin -f usb: -o gpx -F waypoint.gpx
See also: http://www.gpsbabel.org/os/Linux_Hotplug.html, USB Garmin on GNU/Linux
If you have problems accessing the USB0 port on your Ubuntu Linux, you might want to read this discussion thread on Ubuntu Forums and remove the packages brltty and brltty-x11 (Braille support apparently breaks USB serial). Don't forget to power on the GPS unit first!
A maybe useful bash script: download track and waypoints
GPSBabel bash script for downloading tracks,waypoints & routes available from: gerkin
Mac OSX
Under OSX assume the GPS is attached to a serial to USB adapter
gpsbabel -i garmin -f /dev/cu.usbserial0 -o gpx -F waypoint.gpx
Track logs
To read track logs you add a '-t' in front of the input (-i) specifier. So to get tracklogs under Windows:
gpsbabel -t -i garmin -f com1 -o gpx -F tracklog.gpx
Routes
And in the same way, you can read or write routes with the -r parameter:
gpsbabel -r -i garmin -f com1 -o gpx -F route.gpx
Note: When you write a route a waypoint will be generated for each route point. This is annoying. Since waypoints have globally unique names, your route points will be renamed if they collide with another route (a common problem would be numeric names eg. "1" "2" being renamed to "1 1" "2 1" etc.) To prevent this happening use John Dally's patch for gpsbabel.
Writing data to a GPS
You can also write tracklogs, waypoints, and routes back to your gps by swapping the input and output parameters. To write waypoints from waypoint.gpx to a Garmin unit under Windows:
gpsbabel -i gpx -f waypoint.gpx -o garmin -F com1
Using Filters
See using filters with GPSBabel for information on using GPSBabel filters to edit your track.