GPX and KML Route Files Explained
A route file is a small text file that stores places and paths so one app or device can hand them to another. The two common kinds are GPX and KML.
GPX
GPX is a file format for GPS data. Its schema, the rulebook for how the file is laid out, is published by TopoGraphix. GPX is the root element in the XML file, meaning everything else sits inside it.1
A GPX document has a metadata header, followed by waypoints, routes and tracks.1 The three terms mean different things.
- Waypoint: a waypoint, point of interest, or named feature on a map. A campsite or a trailhead is a typical case.1
- Route: an ordered list of waypoints representing a series of turn points leading to a destination. It's a plan.1
- Track: an ordered list of points describing a path. A device often records one as you move, so it shows where you went rather than where you meant to go.1
GPX also follows two conventions. All coordinates are relative to the WGS84 datum, and all measurements are in metric units.1 A datum is the reference model of the Earth that coordinates are measured against.
KML
KML is a file format used to display geographic data in an Earth browser such as Google Earth. It uses a tag-based structure with nested elements and attributes and is based on the XML standard.2
Google's tutorial describes two building blocks you're likely to meet. A Placemark is one of the most commonly used features in Google Earth. It marks a position on the Earth's surface. In KML, a path is created by a LineString element.2
So a Placemark roughly matches a GPX waypoint, and a LineString roughly matches a track or route. The match isn't exact, because each format has its own tags.
Moving files between apps and devices
Every app has its own import and export menu, and the menus change. Neither source above describes those steps, so use the help page of the app you're working in. A few habits cut down on trouble:
- Check the file extension. It should end in .gpx or .kml.
- Keep a copy of the original before an app changes it.
- After loading, look at the line on the map. A route that lands in the wrong place may point to a bad file.
- Save the file to the phone or device itself, not only to a link online.
The last point matters because a file kept in cloud storage can't be opened without a connection. A downloaded map shows the background, and the route file draws the line on top. You need both stored on the device.
Exceptions and limits
Both formats describe geometry and labels. Neither one carries road conditions. A route that was drawn last year may cross a road that's now closed, so compare it with official road sources.
Different apps also read the same file differently. One may show only tracks, and another only waypoints. If a line is missing, the file may not be at fault.
Maps and routes can come from different places, too. Where offline map data comes from covers why a route line can sit slightly off a road.
Notes and sources
- GPX 1.1 Schema Documentation, TopoGraphix
- KML Tutorial, Google for Developers