Read and process GPS data

Data On the Go

© Lead Image © Nataliia Natykach,

© Lead Image © Nataliia Natykach,

Article from Issue 166/2014

Almost all manufacturers of GPS devices use proprietary formats to save routes, tracks, and waypoints. Vendors unfortunately rarely offer Linux software for uploading and downloading or processing the data. Four GPS editors keep Linux users on the right track.

Most smartphones have a GPS receiver, and handheld GPS devices, sports watches, and bike computers are available today at budget prices. These practical devices can simplify navigation, find geocaches, and record tours with your speed, distance covered, elevation, calories burned, and much more. With a chest strap, training computers can also measure your pulse.

If you want to analyze the data later on your PC or show it to family and friends, you first need to transfer the logs to your computer. A software tool helps you evaluate and rework the raw data.

Many outdoor enthusiasts like to plan their hiking, cycling, and running routes in advance. On the web are many portals where users can compose tours online and then download the results. The community also exchanges data and more on sites like GPSies [1], [2], BikeNet [3], Outdoor Active [4], ShareMyRoutes [5], and EveryTrail [6]. A breakdown of features offered by various GPS editors is shown in Table 1.

Table 1

GPS Editor Features

















Yes (no GUI)





More than 150

GPX and KML natively; others via GPSBabel import

16 natively, including GPX, TCX, FIT, CSV

More than 150 (uses GPSBabel)

Import/Export GPS device


Yes (via GPSBabel)

Import only


Map material

Google Maps (GUI only, preview only)

OpenStreetMap, OpenCycleMap, Maps-For-Free, Hikebikemap, OpenSeaMap, and many other services

OpenStreetMap, Shuttle Radar Topography Mission, optional import of other services

OpenStreetMap, Google Maps

Save maps for offline mode





Edit tracks





Edit routes





Edit waypoints





Additional features

Various filters, GUI (gpsbabelfe)

3D maps, photos, audio files, POV-ray export, statistics (via Gnuplot), Online services (SRTM, GPSies, Wikipedia, OpenWeatherMap)

3D maps, pulse rate analysis, user management, photos, tour description as PDF

Route planner, upload your own routes and tracks, access to data from other users

Building Blocks

All of this would be easy and convenient if there were a common format for storing and exchanging GPS data. Although more and more devices and programs rely on the XML-based GPX, other exotic formats are also on the market. The vendor software is usually no great help, especially because it typically runs only on Windows and rarely on OS X. Luckily, some free programs now deliver good results on Linux, too. I investigated four of them.

In the lab, the GPSBabel [7] C program battled three Java applications: GpsPrune [8], MyTourbook [9], and RouteConverter [10], all of which need a Java runtime environment. On the Ubuntu lab machine (14.04), they worked perfectly with the OpenJDK Runtime Environment (Iced Tea 2.4.7). The idea was to see how the programs handle the GPX files and TCX files from two Garmin devices (USB connection) and various KML files created using Google Maps.

In addition to the display options, I was especially interested in the editing features for tracks, routes, and waypoints; the export capabilities; and any additional features that came with the editors.


The first test candidate is a true quick-change artist. GPSBabel [7] reads and converts more than 150 GPS file formats from different vendors [11]. The tool, which is licensed under the GPLv2, also has protocols for reading from and writing to GPS devices, as well as filters that are used for converting. For example, they let you simplify routes, delete inaccurate waypoints, and more. A special mode processes the positional data of a connected device in real time.

The repositories always offer you slightly old GPSBabel packages. Because the tool is developing rapidly, however, I looked at the latest version (1.5.1 when this issue went to press) by downloading the tar.gz archive and building the tool from the source code. To do this, I first installed the libqt4-core and libqt4-dev packages and their dependencies on the Ubuntu lab machine, so I could try out the included Qt GUI.

GPSBabel is a command-line tool. A program call typically follows this pattern:

gpsbabel -i <input format> \
  -f <input file> -o <output format>- \
  F <output file>

The gpsbabel -? command lists all input and output formats. Instead of a file, users can also provide an interface for a connected GPS device for -f, for example, -f usb: or -f /dev/ttyS0.

GPSBabel reliably detects most of the supported formats, whether the data consists of routes, tracks, or waypoints. Some Garmin and Magellan devices need help, however. Users can then work with the -r, -t, and -w (default) parameters:

gpsbabel -w -i garmin -f usb: -o gpx -F waypoints.gpx

This command sends the waypoints from a Garmin device plugged in to a USB port to the hard disk and stores them in the waypoints.gpx file. If you also want the program to download the tracks and routes, simply add -t -r directly after -w.

GPSBabel always works its way through all the options from left to right. The tool can also handle more demanding user requirements. For example, it can read data from multiple files in a variety of formats, apply filters, read more data, and bundle the results into a single output file. The manual on the website contains detailed explanations and examples of this and other scenarios.

Well Filtered

To edit routes, tracks, and waypoints, users define filters after -x. In this case, too, the order in which the parameters are called is important. A filter that is before the input file thus has no effect. Instead, you can insert filters multiple times between different input and output functions in a command. This means that you can add points before and after curves in a route or only set points within a polygon, arc, or radius.

Users also can manipulate the altitude and their track lists; they can sort and remove waypoints, tracks, and routes or simply delete duplicate points with GPSBabel filters. To do the latter, the tool either looks at the name or the coordinates. For more flexibility, one filter removes a point only if it is within a certain distance of another point; users can define this distance in feet or meters. Chapter 4 of the manual describes all the filter options in detail and shows some sample calls.

The GPSBabel sources include a simple Tcl GUI called guibabel, which the developers are obviously no longer maintaining. Additionally, you can use the Qt interface mentioned earlier. You install this by changing to the gui subdirectory and then typing qmake, followed by make. You will find the binary in the subfolder GPSBabel1.5.1/gpsbabelfe-bin. After selecting the input and output formats, the GUI offers you an Options button that lets you access the options.

Clicking on Filters opens the Converter dialog (Figure 1). Checkboxes and fields let you edit routes, tracks, and waypoints, and you don't need to trawl the manual for all of the -x options. After pressing OK to confirm your choice, the complete GPBabel command appears in the area at the bottom. More options let users view their tracks, routes, and points in Google Maps. However, the map view does not support editing and only serves as a preview.

Figure 1: Users launch the GPSBabel GUI by typing gpsbabelfe. It offers convenient access to the options and filters.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Perl: Plotting GPS Data

    Perl hackers take to the hills with a navigation system that provides a graphical rendering of a hiking tour.



    Digital GPS-aided treasure hunts, or geocaching, is becoming more popular. We investigate the choice of geocaching software available for Linux.

  • Geotagging

    Add location data to your best digital images with digiKam and GPS Correlate.

  • Pathfinder

    When Mike Schilli is faced with the task of choosing a hiking tour from his collection of city trails, he turns to a DIY program trained to make useful suggestions.

  • GPX Viewer

    With GPX Viewer you can map GPX tracks and view GPS data in a web browser. It's a simple way to revisit a recent vacation, organize your photos, or map your favorite bike routes.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More