GPX (GPS Exchange Format) Files

Hiking

So one of the ways I pass the time is by hiking.  Of course, I’m also a data junkie, so I like to blog about my hiking experience (frankdecairehiking.blogspot.com) and I like to track information about the hike.  My wife invested in a data watch made by Garmin (the Forerunner 15).  It has a little GPS receiver built in and a USB port that allows the user to track their position and then download the data.  In the software that is used to download and synchronize the watch is an export function that will export to many types of files.  The GPX file is the most useful for me since it is an XML output of the GPS coordinates.

Here’s an example of actual data contained in the file:

As you can see there is an element called trkpt which is a track point and contains longitude and latitude information.  The elevation information is not provided by the watch, but the software inserts it from a database of elevation coordinates for each location on the Earth.  Google Maps can also insert this data when you import it into Google Maps.  Did I mention that you can upload this to Google Maps.  Oh yeah.  It’s sweet.

Before I describe what Google Maps can do with this data, let me also mention that the time stamp and other information can appear in this data set.  So in the above data, you can see that my wife was standing at GPS position 38.76018354669213,-78.28429399989545 (lat,long) at 6:03 pm zulu time (or 2:03 pm EST) on August 9th, 2015.


Google Maps

There are a lot of applications that can accept the GPX files, but Google Maps is rather nice for hiking maps.  Why?  Because Google Maps provides a Terrain map that shows the elevation information.  To create a custom map, you can sign into Google (assuming you have an account).  Then click on the triple line icon to the left of the search text box.  This will open a menu and you can select “My Maps”.  A drop-down will appear below the search text box and you can click the “Create” button (it has a pencil icon).  Then click the “Import” link that will appear, and a drag and drop screen appears:


Just drag your GPX file into this rectangle and Google Maps will import your data.

Next, you’ll want to change your base map.  There’s a drop-down arrow to the left of the “Base Map” text.  Click that and select which map type you want.  For hiking in the mountains it’s best to use the Terrain map.  You can also edit the map title, the names of the start and end points, etc.  When you have completed your map, you can make it visible to those who poses the link.  Like this: https://www.google.com/maps/d/edit?mid=z5denw_V-Nlo.kpnvxWGfEG6I

That’s a link to this map:


Another trick is to edit the data points.  You can delete as many trkpt elements as you’d like.  This is handy for cleaning up any double-lines, or if you wandered off the trail and you don’t want to show that data.  This also means that you can add points.  If you wanted to extend your trail to end at a point that you didn’t actually record, you can get the point on Google Maps by right-clicking at the location you want and select the “Where’s here?” menu item.  You’ll see a set of GPS coordinates below the search box.  Copy these into your xml and fix-up the tags.  Be aware that the points reported by Google Maps is in latitude then longitude.  So don’t mix up the first coordinate with the second coordinate, or your point might end up in Antarctica.

If you’re looking for the official GPX schema, click here.

If you’re looking for the official documentation, click here.