Merging gpx files

I have several .gpx files from commuting to work and other small trips around town. What if I want to merge several files into one big file? Use gpsbabel!

What is GPSBabel?
GPSBabel converts waypoints, tracks, and routes between popular GPS receivers and mapping programs. By flattening the Tower of Babel that the authors of various programs for manipulating GPS data have imposed upon us, it returns to us the ability to freely move our own waypoint data between the programs and hardware we choose to use. It also has powerful manipulation tools for such data. It contains extensive data manipulation abilities making it a convenient for server-side processing or as the backend for other tools.

Oh, it’s also open source (free) and runs on almost every OS. Sounds perfect for a Linux user. Here is how I installed and used it on my Debian server.

Grab the source code tarball from the ‘net and compile.

$ tar zxvf gpsbabel-x.x.x.tar.gz
$ ./configure
$ make
$ sudo make install

Then my first time using the program with the merge option….

$ gpsbabel -t -i gpx -f 20120706.gpx -i gpx -f 20120707.gpx -x track,merge,title="COMBINED LOG" -o gpx -F bigtracks.gpx
GPX: This build excluded GPX support because expat was not installed.

Oh no, an error! Probably missing a library. I will need to find out what is causing the problem, fix it and recompile the program.  Some quick Googling and…..

$ sudo apt-get install expat libexpat-dev

That worked! The results of all the random .gpx files I had at the time are merged on the map below.

Total distance: 198.75 mi
Max elevation: 925 ft
Total climbing: 18516 ft
Total time: 19:34:29
Download file: bigtracks.gpx

 

Leave a Reply