Spainbanner white v4

GPX editor

23rd March, 2016 - Round Spain on a Mountain Bike

If you are doing along distance ride you'll probably end up wanting or needing to edit satnav files. So here is some basic info on satnav files and how to edit them; I hope you find it helpful.

You may want to edit files for various reasons:

  1. you will sometimes end up going back and forwards in the wilderness until you find a route that works. So you may want to edit out all the exploration and just show the route that works.
  2. the satnav file may be too large, and you want to "thin" the waypoints, removing say every 4 out of 5.
  3. files you pick up off the internet may be in proprietary formats which you want to change, or
  4. such files may contain corrupt lines (this happened to me) so you'll need to inspect them to find the problems
  5. you may want to cut up or combine routes

Satnav files are written in XML (Extensible Mark-up Language). This is a development form HTML (HyperText Mark-up Language) which underlies web pages . Once you get to look at a file it's pretty easy to understand what's going on. You can also get explanations off the web.

Basically the files start with some introductory information, and then has a list of elements which define:

  • as a minimum, the longitude and latitude of a point, but then also optionally
  • the altitude or elevation <ele>
  • the date and time it was recorded <time>
  • the velocity
  • a name <name>

The files may be recording "Track Points" <Trkpt>  or "Waypoints" <wpt>. I've never worked out the difference and both seem to work well. Track points may be grouped into Track segments <trkseg>

If you want to see a satnav file, you can do this easily by changing the file extension from .gpx to .txt (i.e. to a normal text file). You can then open it in a simple text editor such as Wordpad or note pad on Windows systems. DO NOT use something more complex like MS Word or it will automatically interpret the XML as HTML and start to add in its own tags. This will corrupt your file.

Looking at the file code is useful for general understanding, but crucial if you want to "thin" the file or look for corrupt entries. I was delayed for hours several times on my journey by files failing to load. I had to open the .gpx files as .txt and scan them until I found lines that looked unusual or had obviously corrupt elements. This can take some time as the files can be thousands of lines long.

For thinning a file I used excel. I cut and pasted the XML elements into a spreadsheet and then wrote some code to get excel to pick out every tenth line. I then just pasted the result back in to the text file, saved it and changed the extension back to .gpx.

For more simple procedures you can edit the .gpx files using an editor. I use freeware called "GPX Editor" by Pixel K. It is a bit clunky and sometimes goes wrong but works well for  looking at routes on Google (if you're on-line), cutting files up and splicing files together.

During preparation I also looked at Viking software. At the time it wasn’t as good as GPX Editor, but the latest release looks better.


Add a comment: