What is a GPX File?
|In This Guide|
A GPX file, also known as a GPS Exchange Format file, is simply a text file with geographic information such as waypoints, tracks, and routes saved in it. You can use GPX files to transfer that information between GPS units and computers. In this article, I’m going to demystify the GPX file in non-tech language so that you can use them effectively. I’ll also answer some common questions such as “what is the difference between a route and a track?”
What is a GPX File Video
What’s in a GPX File?
If you open up a GPX file, you’ll see that it’s simply a text file. You can open a GPX file with any text editor or word processor. There are also more sophisticated tools that offer mapping and are easier to work with, and I’ll talk about those later. The GPX file was specified in the text format so that any type of device could easily open and read it without a fuss.
If you open a GPX file with a text editor and it’s not formatted nicely like this or is all on one line, just cut and past it into a tool like XML Beautifier, process it, and then paste it back to your file. Sometimes programs remove all the white space from the GPX file to reduce the file size. GPS Units just look for the XML language in the file and don’t care about the whitespace, although most programs will save it with the indentations to make it easier for humans to work with.
- Some tags, like <name> above, have the information between an opening and closing tag: <name> and</name>
- Other tags, like <trkpt> above, have the latitude and longitude information inside them as attributes, and just have a closing / at the end.
GPX Tag Naming Standards
The GPX file format is called an “open standard” meaning that it can be used on any device for free regardless of brand. In order for that to work, there has to be standard tag names within the GPX file. Those standard tag names were first established in 2002, and then updated in 2004 with the latest version of GPX, GPX 1.1.
Save GPX files in the latest version, GPX 1.1, if you are given an option.
You can take a look at (the very dry) different types of information that a GPX file can have here, but there are only a few big ones that you need to know about: waypoints, routes, and tracks.
Understanding Latitude and Longitude in Your GPX File
Before I show you the GPX file data for a waypoint, we need to talk about latitude and longitude. In a GPX file they are stored in WGS 84 format, which is a mapping reference system created by the U.S. Department of Defense for GPS. You can simplistically think of it as a decimal equivalent of the latitude and longitude that you learned about in school (and you convert between them with this tool). For example, a coordinate in WGS 84 is -77.508333, and in traditional latitude would be S 77° 30′ 29.9988″ (degrees minutes seconds). Any unit that uses the GPS satellites will expect the GPX data in this WGS 84 format.
The Russian GPS system, GLONASS, uses a different mapping system, PZ-90. The European GPS system, Galileo, uses one called GTRF. Even if your GPS unit supports receiving those signals, your GPX file will still use the WGS 84 decimal units.
The number of decimal units (to the right of the decimal point) determines the accuracy of the waypoint. When you are recording a waypoint in the field on your GPS device, the accuracy is based on your GPS fix. This table will let you decode the decimal points in your waypoint and determine how precise it is (but if the GPS is not that accurate, it can also be an incorrect GPS fix while still appearing to be precise).
|4||0.0001||Individual street or land parcel|
|7||0.0000001||Practical limit of commercial surveying|
|8||0.00000001||Specialized surveying such as tectonic plate mapping|
But wait! If you’ve looked at the values in your GPX file, you’ll notice that the decimal value is much longer than that, often greater than 13 decimals on Garmin units. 13 decimals of latitude precision would be about the width of a row of 100 silicon atoms. I’m not privy to Garmin’s engineering secrets but I suspect it’s based on a division calculation done in the unit to generate the latitude and longitude. They just dump all decimals from the mathematical operation in there instead of rounding up to a practical precision point such as 5 or 6 decimal places.
So the takeaway here is that in the GPX file you are looking for 5-6 decimal places of latitude and longitude accuracy to make sure that you’re on a trail. Anything more is waste and anything less is not accurate enough.
Most consumer GPS units are accurate from 10-50 feet depending on the fix. You can also spend thousands of dollars and get a professional GPS that is accurate to a few centimeters. If you really need a good waypoint fix, try waypoint averaging (as seen on the GPSMAP 66i here).
While the minimum information for a waypoint is latitude and longitude, you need a few more pieces of information if a waypoint is really going to be useful. Most GPS units will allow you to additionally specify these fields:
- Date and time it was created (in UTC)
- Description (<desc> in the image above)
- Comment (<cmt> in the image above)
- Elevation (in meters)
- Type (category)
There are a total of 19 data properties that you can add to a waypoint. Most of the ones I haven’t mentioned are not used much and include technical elements like magnetic variation and satellite fix type.
This is a good time to mention a group of tags that you might see in a GPX file called “extensions.” When the GPX format was specified, they realized that there might be extra data specific to a GPS unit or manufacturer that needed to be stored. So they created a freeform section called “extensions” where everything between the <extension> and </extension> tag can be anything.
Extensions are usually only read by the manufacturer who put them in. So if you have a TomTom GPS, it probably doesn’t read Garmin GPX extensions, and vice-versa. You can see a (very dry) list of all of the Garmin GPX extensions here to get an idea of what’s available. Extensions can be used with any entity in a GPX file including waypoints, tracks, and routes.
Here are some examples of extensions from Garmin:
- Street Address
- Line color
And to make it even trickier, there are some extensions that are device-specific and are not documented. Just know that anything you see under “extensions” will be brand and/or device-specific and probably won’t transfer well between different brands or devices.
The easiest way to think of a track is like a chronological breadcrumb trail of waypoints. Between each track point is simply a straight line. Generally tracks are created when you record your activity on a GPS. Some GPS units let you specify how often it should take a track point. The more track points you take, the more accurate your track (and also the more you drain your battery).
Many Garmin GPS units offer “smart recording” or “every second recording” (or some variation of those). “Smart recording” only drops a track point when you change direction, speed, elevation, or heart rate. “Every second recording” does what it says. Unless I’m in a situation where I am really trying to conserve battery, I always use “every second recording” to get a track with more fidelity.
You can find tracks in your GPX file by looking for everything between the <trk> and </trk> tags. Within the track you’ll find many <trkpt> tags with the individual track points, which you can think of as waypoints. That’s a track at it’s most basic.
Most GPS units and mapping software will add optional track data tags to a track in order to make it more descriptive. There are 21 optional tags for track points, and some common tags that you’ll encounter are:
- Track Segment – <trkseg> – This is a logical grouping of track points. For example, if you have a GPS that you turn on and off every day on a multi-day trip, each day will be contained in a separate track segment. Within track segments you’ll see track points.
- Name – <name> – The name of the track. Sometimes you can specify this and other times the GPS will name it automatically for you.
- Type – <type> – The category of the track point. On Garmin units this is usually your activity type (hiking, running, biking, etc.)
- Time – <time> – The time that the point was recorded. This is important when figuring out your speed.
- Elevation – <ele> – Elevation of the track point in meters.
- And then tracks, track segments, and track points can all have extensions (as we described earlier) as well.
You don’t need a map to follow a track. You’re either on the line or you’re not.
Active Tracks & Saved Tracks
Many Garmin outdoor GPS units have two types of tracks: active and saved. An active track is the track points for your current activity, usually seen and tracked on the trip computer screen. If you want to save the track and get it off your device as a GPX file, you have to save the track. Each GPS unit is different, but generally if you don’t save it, it won’t be available to transfer off a device as a GPX file.
If you think of tracks as detailed breadcrumb trails between point A and point B, a route is simply point A and point B, without any information in between. You can also think of it as an itinerary of waypoints. First I want to visit the Eiffel Tower, then the Louvre, and then the Arc de Triomphe. Those points are in the route, but it’s up to my GPS device to get me from one attraction to the next. Generally a GPS will alert you when you arrive at each point along the route and when there is a significant navigation change such as a turn or intersection.
If you look at a route in your GPX file, these are the tags:
- Route – <rte> – Everything between these tags describes the route.
- Route Point – <rtept> – Route points are the waypoints along the route.
- All the usual descriptors such as name, comments, description, symbol, etc.
Now to add a wrinkle into that, routes can include significant turns and landmarks on the way. These are called “shaping points” in the Garmin world and are treated just like points along the route to keep you on a planned route, but the GPS will not alert you when you pass along a shaping point. Shaping Points are an extension within the GPX file. Regardless of how many via points or stops you have between the start of the route and the finish, it’s up to the device to get you from each landmark on the route.
Shaping points and via points are the same thing.
How GPX Routing Works
I mentioned earlier that the device (whether GPS, smartphone, or computer) will “fill in the blanks” between the different route points to give you directions. And since there are usually multiple ways to get from A to B, GPS units usually have options on how to route you. If you ever use Google Maps or Waze for driving directions, you see this routing concept in action all the time as they (automatically) route you from A to B around traffic and slow-ups.
One of the simplest routing options offered by almost every GPS is “straight line” which is what it says. It will route you across land, water, lava, whatever between A and B. On the water it’s great, but if you’re using a route anywhere else, not always the best option.
Other options include things like “shortest distance,” “shortest time,” and “most popular.” They all will route you on roads or trails, but they depend on having those (routable) roads and trails on the actual GPS unit. Routable roads and trails are usually found on maps that you can load on the device (or ones that have been preloaded). But it’s important to not that not all maps are routable. If you are loading new or custom maps onto a GPS, you must make sure they are labeled as “routable” if you want to use them in route calculations. Otherwise the unit will default to straight lines.
Most GPS units come with some sort of routable maps on them. For example, Garmin TopoActive maps which come bundled on units like the Fenix 6x, GPSMAP 66i, and eTrex 32x are all routable. You can also download free routable Open Street Maps (OSM) for your GPS. OSM maps are community-sourced and generally have more trails (including small and overgrown) on them.
If you are a Garmin user, I wouldn’t buy maps from them if they didn’t come free with your GPS unit already. Garmin TopoActive maps are based on the OSM map data. They’re a little prettier, but otherwise not worth your money.
Should I Use a GPX Route or Track?
First off, just a reminder that this is a hiking website so I’m going to focus on using routes and tracks on the trails here. If you are navigating in a car, walking streets, or on the water, just use a route (as you would when you use something like Google Maps).
- If you are planning a hike on the computer before you hit the trail (recommended), then use a track so that you can precisely position yourself on the trails that you want to take.
- If you need to just navigate without any planning (I’m frowning at you now…) and don’t care which way you get somewhere, then use a route.
Note that routes don’t take anything like beauty or current trail conditions into account when plotting the course between route points. It’s just a cold, hard, computer calculation. I generally use routes when:
- I’m on a hike, am unfamiliar with the area, and need to bail out to a road or civilization.
- When I’m in a new city and I want to plan a run on the fly using popular routes (using popularity routing on my GPS watch).
- If I’m planning a run or bike ride in advance on the computer with Garmin Connect and want to use shaping points to ensure my route avoids any undesirable roads or trails.
FYI When hiking in the backcountry I always use GPX files in conjunction with paper maps. Generally my workflow is to plan out a hike on the computer and paper map by researching the area, landmarks, and conditions. Then I create a GPX and send to my GPS unit(s). When I’m actually on the trail, I use the paper map and my knowledge of the route (from planning) to make navigation decisions. If I am ever unsure of my location, I consult my GPS with the GPX track and see where I am in relation to my planned GPX track.
How Do I Open a GPX File?
Since everyone has a different workflow and preferences, and there are dozens of pieces of software and web apps to work with GPX files, just note that these are the tools that work best for me. I encourage you to play around with different tools and see what works best for you.
- Text Editor – You can open the raw XML data of a GPX file and update it using any text editor. On a Mac, there’s the standard TextEdit, and on Windows there’s Notepad or Wordpad. You can also open a GPX file with a word processor like Word or Google Docs; just remember to save it as a text file. On the Mac, I prefer the free BBEdit text editor which you can get in the Mac Store.
- Garmin Basecamp (free) – You don’t need a Garmin GPS to use Basecamp, it will work with any GPX file. And while there are aspects that are clunky, it allows you to easily plot waypoints, create tracks, and create routes. You can also do things like split, reverse, and join tracks. Basecamp doesn’t come with any useful maps but you can easily install free OSM maps to work with. If you have a Garmin GPS unit, you can plug it into the computer and transfer GPX data back and forth. And if you have a Garmin GPS with maps, you’ll be able to see them (and plan with them) in Basecamp if you plug the unit in.
- CalTopo Website (free) – CalTopo allows you to select from tons of map layers and create tracks and waypoints and then export them as a GPX file.
- GaiaGPS Website and Apps (free and premium memberships available) – Another site similar to CalTopo with a slicker interface that’s a bit more user-friendly. You can create GPX routes and waypoints and export to your computer or the Gaia GPS app(s).
- GPSVisualizer Website (free) – This website has many tools for GPX files, including adding elevations and file conversion.
- Google Earth (free) – Load your GPX tracks in here and then pan around in 3D. It’s a great way to understand the elevation profile while interacting with the GPX file.
- Garmin Connect Website and Apps (free) – If you want to create routes or courses based on popularity and transfer to your Garmin smartwatch, try the Garmin Connect Course Planner.
- AllTrails Route Converter (free) – This used to be the website GPSies, which AllTrails acquired. With this converter you can transfer GPX files to other formats (and vice versa) and can also convert routes to tracks (and back).
How to Get GPX Files
If you’re eager to get your hands on some GPX files to help you on your new hike, there are a few places you can look.
- HikingGuy – For all of my hike guides I have a GPX file that you can download based on my actual experience on the trail. Many other hiking websites have similar GPX files for download too (but I can’t vouch for their quality).
- AllTrails Website – You can browse the community based hike sharing website for GPX files to download. I’ve found that while AllTrails is a great resource to see what’s available, the GPX files sometimes are not that great. They can include signal dropouts, side trips by the user, etc. so use them after examining them.
- GaiaGPS – You can download other user’s GPX tracks like you can with AllTrails.
How to Create a GPX File
There are a ton of ways to create GPX files, and you could even theoretically write your own text file using Notepad, but that would be painful. Here are my tips for creating GPX files before your hike.
- Tracks – I use CalTopo to create tracks and make heavy use of the different layers to understand the terrain, weather, and history (like past fire damage, landmarks on old maps, etc.).
- Routes – Right now GaiaGPS has the best “snap to” tool for creating routes on the web in my opinion. I’ll also use Garmin Connect to create routes (called “courses” in that world) for trail runs and sports activities. I appreciate the popularity heat-map when I travel to new areas.
- Waypoints – Either CalTopo or GaiaGPS are effective.
A runner up is Garmin Basecamp, which does tracks, routes, and waypoints well, but lacks the depth of data layers that the other tools do. I wish I could overlay weather, etc. in Basecamp, but you can’t.
Now you can also record tracks on your GPS route and save them. Each GPS and brand is a little different and it’s beyond the scope of this article to cover them all, but it’s easy enough to read the manual and figure it out. I have a guide to creating hiking routes and sending them to your Garmin GPS here.
Here are some odds and ends about GPX files and GPS that folks have asked me over the years. If you have a question that I haven’t covered, contact me and I’ll do my best to answer it.
Who uses the GPX file format?
Pretty much anyone who offers a GPS unit, app, or software will support the GPX file format. That includes Garmin, Suunto, TomTom and Magellan.
What is the GeoJSON file format?
You might see options to get tracks in GeoJSON format. GeoJSON is a new format with these differences:
- Smaller file size
- Larger variety of data you can include in the file including geographic boundaries.
GeoJSON files are not generally compatible with or readable by GPS units, especially older ones.
What is the KML file format?
You might also see options to download a KML file, which stands for Keyhole Markup Language, and was developed to save Google Earth data. KML can contain the same elements as a GPX file but was intended to store mapping presentation and annotation data. Most GPS units don’t read KML.
My Garmin Has FIT and TCX Files, should I use them instead of GPX?
TCX and the newer FIT file format are proprietary to Garmin and contain essentially the same information as a GPX file. Unlike a GPX file, which doesn’t natively have support for things like heart rate (without using GPX extensions), TCX and FIT files are more sports oriented and do have that type of data. They are often used to share courses for running and cycling.
How many waypoints, tracks, and routes can I store on my GPS?
It depends on the GPS unit that you’re using and you can usually find the answer on the support site for a brand. For example, here’s the limits for the GPSMAP 66 series on the Garmin support site. If you use a GPS app on your smartphone the limit is usually based on your phone’s storage.
What if my map is not WGS84?
This can get a little tricky, but the thing to remember is that in the GPX file, the latitude and longitude should always be in WGS 84 format, regardless of what your map is encoded in or what types of units you look at on the screen. For most Garmin units you have these three settings (usually deep down in the settings).
- Position Format – This is the way that you see your position format on the screen. For example, you can look at it in decimals, hours/minutes/seconds, or MGRS (military grid). There are usually a ton of choices here. The position format you see on the screen is converted from the internal position format used by the device, which is usually WGS84.
- Map Datum – If you’ve loaded a custom map onto a GPS and it’s based on a different position format, you can update the map datum to match it. And like position, any calculations on it need to be converted from WGS 84
- Map Spheroid – The internal position format used on the device. Usually you can view this value, but not change it.
Keeping everything in WGS84 format will minimize battery drain and keep things running smoothly.
Who built GPS?
The U.S. Department of Defense launched the GPS system and it became fully operational in 1993. It’s free for anyone to use, but the government can selectively turn off service for regions or degrade the performance globally. Today GPS is managed by the US Space Force. Since this crucial tool is controlled by the US military, other countries like India have developed their own satellite positions systems. Newer GPS units can receive position signals from some of these newer systems.
- Russia – GLONASS
- Europe – Galileo
- China – BeiDou
- Japan – QZSS
- India – IRNSS
That’s a lot of junk in space!
Should I use GPS / GLONASS / Galileo to record my GPX tracks?
People get passionate when it comes to this subject, and there’s not a clear answer. For me GPS and Galileo seems to provide the best results. But for others, GPS and GLONASS works well. I recommend just trying out the combinations in your area. Not that receiving from multiple satellite networks will drain your battery about 5-10% more (my experience with various Garmin units), and GPS alone can work well too.
What is WAAS and should I use that?
WAAS (Wide Area Augmentation System) is simply stated a data update to address any GPS satellites that may have slightly changed course or speed. It’s another signal that your GPS unit can receive from the GPS satellites that contains the correction information. So your GPS unit takes that correction information and applies it to any satellites that need to be corrected. If you want a more precise read, use WAAS. If you want to save battery, turn it off.