Living with a Garmin:

Struggling with GPX

GPX is the universal interchange format for map programs and GPS devices ... well maybe -

If you try to push the boundaries of your GPS usage, you soon come across the GPX file format.

Most map and GPS-related programs have an option to output, export or Save As GPX, and most likewise have an option to import or Open GPX files.
In particular, most options for downloading route information from online mapping services such as Google Maps, give you a GPX file, or sometimes just a wodge of text that can be saved in a text editor with the .gpx extension.

As a sidenote - from the above you can see that any GPX file can in fact be opened and inspected (or even edited) using a Text Editor such as Notepad - or even, with care, in MS Word!
However you should avoid editing a GPX in this way if at all possible - look, but don't touch would be a good motto here - and if you do alter it, use a Save As to preserve the original, just in case.

In practice, it is quite common for a program to be unable to open a GPX from another source, or, it opens but appears to be altered in some way, or appears as a Route when you were hoping for a Track, etc.

Several free or inexpensive utilities can be found on the web to help with these difficulties - however I must say straight away that they all tend to geekiness compared even with standard desktop mapping software (and that can be bad enough!).

For example, a GPX file downloaded from Bikely will not open in Mapsource or you don't even have Mapsource.
The simplest solution is to download and install EasyGPS.
Open the GPX file, and Save. Now it will open in Mapsource. Or, just open the file and transfer it to your GPS direct from EasyGPS.

Example: a Route built in Bikely using 'follow roads' is downloaded as a GPX, but has too many Waypoints. Most Garmins will only allow a max of 250 points in a Route, or 500 in a Track. It needs to be converted from Route to Track, and maybe it needs to be downsampled.
GPSBabel is a one-stop shop for all this, and will also do the other job, above. But it is much geekier.
Fortunately for Windows users, the zip download includes GPSBabelGUI.exe and this is a clunky but usable graphical interface to what is basically a command-driven program. Just unzip everything and then run GPSBabelGUI.

Now you can select an Input format of GPX XML and an Output format of - well, Garmin Mapsource gdb.
(Or, again, you can output direct to your GPS.)
Browse to your input file, and browse to the same file again on the output side but change its name to do a Save As.
Now look at some Options. On the output side, select the tickbox for version and set it to v2.
Next to What? tick Routes (Bikely GPX is formatted as a Route).
Now open the Filter. Select Transform and Routes -> Tracks, select Simplify and Limit to 500 Points.
You can name the Track as well if you want, at this point. Then it's OK and Lets Go

That was pretty complicated by Windows standards but it got a lot done, and this program can solve a lot of otherwise knotty problems. It can even convert Autoroute files, and some other problematic formats like Tracklogs and Fugawi.
GPSBabel is highly recommended, for anyone wanting to get in deep with their GPS.

Francis Cooke


Further Reading ...

The GPX format is a subset of XML. XML is a markup language and therefore simple in concept. 30 years ago, we were comfortable with word-processors where you typed [bold]bold[/bold] like this and [italic]italic[/italic] like this.
However somewhere along the way, the wrong people got involved and XML became very tricky to actually do right. A shame because it infiltrates much of modern computing, far and away from the narrow interest of GPS stuff. It is also a data-centric language and highly organised. So this would be good XML (in the right context):

This data-centric organisation is very apparent in GPX files.
Here's the meat of a very simple GPX file
(this was generated by Google Maps and GmapToGPX which is another very useful free tool):

It doesn't get much simpler than this. (It's just a fragment of course - the full file goes on for pages.)
You can see (even without looking at the Name) that it's a Track - note everything is wrapped in [trk] [/trk] tags.
You can see that each Trackpoint - apart from the first 2 - consists of a simple pair of co-ordinates, no more, no less.
The first two have (optional) Comment fields that can be displayed (optionally) in the GPS where and when appropriate.
The [trkseg] tags indicate that the enclosed [trkpt]s are to be treated consecutively, to form a continuous Track.
(Two or more [trkseg]s would indicate a broken track, due maybe to tree cover.)
The whole is enclosed, with some header lines that I haven't shown here, in a pair of [gpx] tags and an [?xml] header, and the result is a file that Mapsource is completely happy with.

Here is the sort of thing that Bikely puts out:

Still pretty simple. This time you can see its a Route. See the [rte] [/rte] wrapper tags?
See how, unlike the earlier example, each Routepoint has a Name. Bikely always names its output like this - so you have to watch out for that when loading multiple Routes into the GPS - the names sometimes need to be altered. (This is a job that GPSBabel can do.) (Name conflicts only occur with Waypoints - it is possible to load multiple Routes with identically-named Routepoints but most GPX conversions create a (spurious) set of Waypoints as well. If you strip out the [Wpt] sections - or simply take care not to load the Waypoints to the GPS - then you don't need to rename the Routepoints.)
In some files, there is all sorts of other information enclosed between the [rtept] wrappers, none of which is actually needed by the GPS, though some might be used if its there. Here. for example, the [ele] height information is completely spurious.
A Bikely file is not acceptable to Mapsource - but its nothing to do with the spurious information, which is not a problem - however Mapsource is sensitive to the orderin which these properties are presented in the script. Having the elevation after the name is what breaks the example above - this simple modification below - with no alteration to the headers - is completely acceptable to Mapsource:

Finally, a quick glance at the much richer GPX that Mapsource itself generates - this is just 3 routepoints ...

All that spurious code - you can see why the GPS has limits on the number of waypoints!!

Francis Cooke

Google Maps
Bikely
GmapToGPX
EasyGPS
GPSBabel

Living with a Garmin: The Waypoints Limitation
Living with a Garmin: Track, Route or Autoroute
Living with a Garmin: Struggling with GPX
Living with a Garmin: Battery Runtime and Etrex Jitter
Living with a Garmin: Living with Metroguide Maps
Living with a Garmin: Declutter the Page Sequence
Living with a Garmin: Screens you don't see every day
Living with a Garmin: Less is More

Francis Cooke's Garmin Menu Map (pdf)