PitStopper.net

Articles - Guides & Resources

How to Read a GPX File: A Complete Guide

If you've ever downloaded a cycling route, shared a hiking trail, or exported a run from your GPS watch, you've probably encountered a GPX file. But what actually is one? And what's inside it?

This guide explains everything you need to know about GPX files — from the raw XML inside them to practical tips for opening, editing, and using them in your outdoor adventures.

What Is a GPX File?

GPX stands for GPS Exchange Format. It's an open standard based on XML (a structured text format) that stores geographic data — routes, tracks, and waypoints — in a way that any device or application can understand.

The format was created by TopoGrafix in 2002 and has since become the universal standard for sharing GPS data. Whether you're using a Garmin, Wahoo, or Hammerhead device, Strava, Komoot, or RideWithGPS, they all speak GPX.

This interoperability is the whole point. You can plan a route in one app, export it as GPX, and load it onto a completely different device. No vendor lock-in, no proprietary formats — just a simple text file that describes where to go.

What's Inside a GPX File?

A GPX file is plain text. You can open one in any text editor (Notepad, VS Code, TextEdit) and read it directly. Here's what a typical GPX file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="PitStopper.net"
  xmlns="http://www.topografix.com/GPX/1/1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.topografix.com/GPX/1/1
    http://www.topografix.com/GPX/1/1/gpx.xsd">

  <metadata>
    <name>Yorkshire Dales Loop</name>
    <desc>A scenic cycling route through Wensleydale and Swaledale</desc>
    <author><name>Andrew</name></author>
    <time>2026-03-09T08:00:00Z</time>
    <bounds minlat="54.3088" minlon="-2.0451"
            maxlat="54.4015" maxlon="-1.9200"/>
  </metadata>

  <wpt lat="54.3270" lon="-1.9712">
    <ele>220</ele>
    <name>Aysgarth Falls Cafe</name>
    <desc>Good coffee and cake stop</desc>
    <sym>Restaurant</sym>
    <type>Food</type>
  </wpt>

  <wpt lat="54.4015" lon="-2.0451">
    <ele>526</ele>
    <name>Buttertubs Pass Summit</name>
    <desc>Highest point on the route</desc>
    <sym>Summit</sym>
    <type>Summit</type>
  </wpt>

  <trk>
    <name>Yorkshire Dales Loop</name>
    <type>cycling</type>
    <trkseg>
      <trkpt lat="54.3088" lon="-1.9350">
        <ele>253.4</ele>
        <time>2026-03-09T08:00:00Z</time>
      </trkpt>
      <trkpt lat="54.3091" lon="-1.9345">
        <ele>254.1</ele>
        <time>2026-03-09T08:00:05Z</time>
      </trkpt>
      <!-- thousands more points... -->
    </trkseg>
  </trk>
</gpx>

Let's break down each section.

The Root Element

The <gpx> tag wraps everything. It has two required attributes: version (always "1.1" for the current spec) and creator (the software or device that generated the file). The xmlns attribute declares the GPX namespace, and the xsi:schemaLocation points to the official XML schema definition so the file can be validated.

All coordinates in GPX use the WGS 84 datum (the same coordinate system used by GPS satellites). Latitude and longitude are expressed in decimal degrees, and elevation is in metres. This is defined by the specification — there's no option to use a different datum or unit.

Metadata

The <metadata> block contains information about the file itself. It supports:

  • name and desc: a title and description for the file
  • author: who created it (can include name, email, and a link)
  • time: when the file was created (ISO 8601 format)
  • bounds: a bounding box defining the geographic extent of the data (minlat, minlon, maxlat, maxlon)
  • keywords: for categorisation
  • copyright: licence information
  • link: a URL for more information

Not all GPX files include metadata — every field is optional. But the <bounds> element is particularly useful because it lets applications quickly determine where the data is located without parsing every coordinate.

Waypoints (<wpt>)

According to the GPX schema, waypoints come first after metadata — before routes and tracks. This matters: GPX is defined by an XML schema (XSD), and elements must appear in the correct order for the file to be technically valid. Many applications are forgiving about ordering, but some strict parsers will reject a file with elements in the wrong sequence.

Waypoints are standalone named locations — pins on a map. Each has lat and lon attributes on the element itself, and can contain a range of child elements:

<wpt lat="54.4015" lon="-2.0451">
  <ele>526</ele>
  <name>Buttertubs Pass Summit</name>
  <cmt>Steep climb from both sides</cmt>
  <desc>Highest point on the route</desc>
  <src>OpenStreetMap</src>
  <link href="https://en.wikipedia.org/wiki/Buttertubs_Pass">
    <text>Wikipedia</text>
  </link>
  <sym>Summit</sym>
  <type>Summit</type>
</wpt>

The most commonly used child elements are:

  • ele: elevation in metres above mean sea level
  • name: the display name shown on GPS devices
  • cmt: a comment (typically not displayed, but stored)
  • desc: a longer description
  • sym: the symbol to show on the device (e.g., "Summit", "Restaurant", "Water Source", "Campground") — device support varies
  • type: a classification for the waypoint
  • link: a hyperlink with optional text

Waypoints also support GPS quality fields like <fix> (fix type: none, 2d, 3d, dgps, pps), <sat> (number of satellites used), and <hdop> / <vdop> / <pdop> (dilution of precision values). These are mostly relevant for recorded waypoints rather than manually created ones.

Waypoints are perfect for marking points of interest: water stops, cafes, viewpoints, or hazards. When you load a GPX with waypoints onto your GPS device, they typically appear as named markers that you can navigate to.

Routes (<rte>)

Routes come next in the schema ordering. A route contains route points (<rtept>) — just the key decision points (junctions, turns), not every point along the way. Your GPS device is expected to calculate the path between them using its own mapping data.

<rte>
  <name>Hawes to Reeth</name>
  <type>cycling</type>
  <rtept lat="54.3270" lon="-1.9712">
    <name>Turn left onto A684</name>
  </rtept>
  <rtept lat="54.3850" lon="-1.9200">
    <name>Right at Askrigg junction</name>
  </rtept>
</rte>

Route points (<rtept>) support the same child elements as waypoints — ele, name, desc, sym, and so on. A route is essentially an ordered list of waypoints that form a path.

Tracks (<trk>)

Tracks come last and are the most common element. A track is a recorded path — a breadcrumb trail of every point your GPS logged. Each track contains one or more track segments (<trkseg>), and each segment contains track points (<trkpt>).

Every track point has lat and lon attributes, plus optional child elements:

  • ele: elevation in metres above mean sea level
  • time: the timestamp when this point was recorded (ISO 8601, e.g., 2026-03-09T08:00:05Z)
  • fix, sat, hdop, vdop, pdop: GPS quality data (fix type, satellite count, dilution of precision)

A typical recorded ride might have thousands of track points — one every few seconds. A planned route might have fewer, with the expectation that your device will calculate the road between them.

Why Multiple Track Segments?

A <trk> can contain multiple <trkseg> elements. A new segment is started when there's a break in the recording — for example, if the GPS lost signal in a tunnel, or if the rider paused and resumed recording. Each segment represents a continuous, unbroken sequence of points. Applications typically draw a line through each segment but leave a gap between segments.

<trk>
  <name>Morning Ride</name>
  <trkseg>
    <!-- Points before the tunnel -->
    <trkpt lat="54.3088" lon="-1.9350"><ele>253</ele></trkpt>
    <trkpt lat="54.3091" lon="-1.9345"><ele>254</ele></trkpt>
  </trkseg>
  <trkseg>
    <!-- Points after the tunnel - new segment due to signal loss -->
    <trkpt lat="54.3120" lon="-1.9280"><ele>260</ele></trkpt>
    <trkpt lat="54.3125" lon="-1.9272"><ele>261</ele></trkpt>
  </trkseg>
</trk>

Extensions

GPX 1.1 supports an <extensions> element at multiple levels — on the root <gpx>, on individual track points, waypoints, and more. Extensions allow third-party data to be embedded without breaking the standard format.

The most common extensions you'll encounter are Garmin's TrackPointExtension, which stores heart rate, cadence, temperature, and power data:

<trkpt lat="54.3088" lon="-1.9350">
  <ele>253</ele>
  <time>2026-03-09T08:00:00Z</time>
  <extensions>
    <gpxtpx:TrackPointExtension>
      <gpxtpx:hr>142</gpxtpx:hr>
      <gpxtpx:cad>85</gpxtpx:cad>
      <gpxtpx:atemp>14</gpxtpx:atemp>
    </gpxtpx:TrackPointExtension>
  </extensions>
</trkpt>

This is how devices like Garmin store fitness data within a GPX file while keeping the file compatible with any standard GPX reader. Applications that don't understand the extensions simply ignore them.

Coordinate Precision

You'll notice coordinates like lat="54.3088" — four decimal places. The number of decimal places determines accuracy:

Decimal places Approximate accuracy
4 (54.3088) ~11 metres
5 (54.30880) ~1.1 metres
6 (54.308800) ~0.11 metres
7 (54.3088000) ~0.011 metres

Most GPS devices record 5-6 decimal places, which gives sub-metre precision. More than 6 is rarely useful since consumer GPS accuracy is typically 2-5 metres at best. Planning tools often use fewer decimal places since exact precision isn't needed for a route to follow.

Tracks vs Routes vs Waypoints

This distinction trips people up, so here's the simple version:

Element What it is Typical points Use case
Track A recorded or planned path Hundreds to thousands "Follow this exact line"
Route Key navigation points Tens of points "Navigate via these junctions"
Waypoint A single named location Individual points "Here's a notable place"

When to use tracks: Most of the time. If you're sharing a cycling route, a hiking trail, or any path you want someone to follow precisely, use a track. The receiving device will display the exact line on the map.

When to use routes: When you want the device to calculate its own path between points. Useful for car navigation or when you want the device to use its own mapping data.

When to use waypoints: To mark specific locations — start/finish points, water stops, cafes, photo opportunities, danger spots. Waypoints are typically combined with a track or route.

How to Open a GPX File

In a Text Editor

The simplest way to inspect a GPX file is to open it in a text editor. Since it's just XML, you can read the coordinates, check the metadata, and see how many points it contains. This is useful for debugging problems or understanding what data is included.

In Planning Apps

Most route planning applications can import GPX files:

  • Strava: Upload via the website (not the app) under "Upload Activity"
  • Komoot: Import via "Plan a tour" > "Import GPX file"
  • RideWithGPS: Upload via "Routes" > "Import"
  • Garmin Connect: Upload via the web interface
  • Google Earth: Open directly — it renders the track on the 3D globe

In Web-Based Tools

PitStopper lets you drag and drop a GPX file onto the map. It renders the route, shows the elevation profile, and lets you search for points of interest along the way — water taps, cafes, bike shops, accommodation. You can then export an enhanced GPX with those POIs added as waypoints.

On GPS Devices

To load a GPX onto a GPS device:

  • Garmin: Connect via USB and copy the file to the Garmin/NewFiles/ folder, or sync through Garmin Connect
  • Wahoo: Upload through the Wahoo companion app or sync from a connected service
  • Hammerhead: Sync through the Hammerhead companion app

Most devices will display the track as a line on the map and show waypoints as named markers.

Understanding Elevation Data in GPX Files

The <ele> tag in each track point stores elevation in metres above mean sea level. But this data isn't always reliable.

GPS Altitude vs Barometric Altitude

Your GPS receiver calculates altitude from satellite signals, but this measurement is notoriously inaccurate — errors of 10-30 metres are common, and readings can fluctuate wildly even when you're standing still. This noise creates phantom elevation changes that inflate your total elevation gain.

Devices with barometric altimeters (most cycling computers, some GPS watches) produce much smoother and more accurate altitude data. If your GPX was recorded with a barometric altimeter, the elevation data will be more trustworthy.

DEM Correction

Many apps correct GPS elevation data using Digital Elevation Models (DEMs) — detailed maps of the earth's surface elevation derived from satellite radar. When you upload a GPX to Strava or similar services, they often replace the recorded elevation with DEM-corrected values, giving you a cleaner elevation profile.

PitStopper uses elevation APIs to fetch accurate DEM-based elevation data, giving you a reliable elevation profile even if the original GPX has poor or missing altitude data.

Elevation Gain Calculation

Total elevation gain is surprisingly tricky to calculate. If you simply add up every upward movement between track points, GPS noise will inflate the number significantly. Most tools apply some form of smoothing or dead-band filtering — ignoring small fluctuations below a threshold (typically 2-5 metres) to produce a more realistic figure.

Two people can look at the same GPX file and calculate different elevation gain figures, depending on what smoothing algorithm they use. This is why Strava, Garmin, and your bike computer might all show slightly different numbers for the same ride.

Common GPX Problems and How to Fix Them

Missing Elevation Data

Some GPX files contain only latitude and longitude — no elevation. This happens when the file was generated from a map (drawing a route by clicking) rather than recorded with a GPS device.

Fix: Upload the GPX to a tool that can add elevation data. PitStopper and most route planning apps will fetch elevation from a DEM service automatically.

Too Many Track Points

A day-long recording at one-second intervals can produce 30,000+ track points. This makes the file large and slow to process.

Fix: Use a tool to simplify the track. The Douglas-Peucker algorithm removes redundant points while preserving the route's shape. Most GPX editors offer a "simplify" or "reduce points" option.

Too Few Track Points

Some exported routes have very few points, causing the displayed route to cut across bends or through buildings. The device that created the file expected the receiving device to snap the route to roads.

Fix: Re-route the GPX through a tool that adds intermediate points along the actual road network.

Corrupt or Malformed XML

If a GPX file won't open, it might have invalid XML — missing closing tags, encoding errors, or truncated data (perhaps the device ran out of battery mid-recording).

Fix: Open the file in a text editor and look for obvious issues. Common problems include:

  • Missing closing </gpx> tag at the end
  • Invalid characters in names or descriptions
  • Truncated data (file ends abruptly)

For truncated files, adding the missing closing tags (</trkseg></trk></gpx>) at the end will often recover the data.

Large File Sizes

GPX files are text-based and can be verbose. A long ride might produce a 5-10MB file.

Fix: Compress the file (GPX files compress very well as ZIP) or reduce the number of track points. Removing timestamp data and unnecessary extensions can also reduce file size.

Creating Your Own GPX Files

Recording with a GPS Device

The most common way to create a GPX file is to record an activity. Start recording on your GPS device, do your ride or hike, then export the file. Most devices save in their own format (Garmin uses FIT, for example) but offer GPX export through their companion apps.

Drawing Routes in Planning Tools

Route planners like Komoot, RideWithGPS, and PitStopper let you draw a route on a map. Click points along your intended path, and the tool generates a GPX file with the route snapped to roads or trails.

Converting from Other Formats

Other common GPS formats include:

  • FIT (Garmin's native format): Use Garmin Connect or a conversion tool
  • TCX (Training Center XML): Similar to GPX but includes heart rate and power data
  • KML/KMZ (Google Earth): Use GPS Visualizer or similar tools to convert

PitStopper supports both GPX and FIT file formats directly.

GPX and PitStopper

PitStopper is built around the GPX format. Upload any GPX file and the tool will:

  • Display the route on an interactive map with distance markers
  • Show the elevation profile with accurate DEM-corrected altitude data
  • Search for POIs along the route — water sources, cafes, bike shops, accommodation, and 60+ other categories
  • Add waypoints for discovered POIs, so when you export the file your GPS device will alert you to nearby stops
  • Export an enhanced GPX containing both your original route and the new waypoints

The round-trip workflow — import GPX, enhance with POIs, export GPX — means your navigation device gets the benefit of PitStopper's POI database without needing an internet connection on the ride.

Summary

GPX files are straightforward once you understand the structure. They're just XML text files containing coordinates, and the three main elements — tracks, routes, and waypoints — cover everything you need for outdoor navigation.

The format's simplicity is its greatest strength. A GPX file created on one platform works on any other. No accounts, no subscriptions, no compatibility issues — just a universal way to describe where you've been or where you want to go.

Next time you download a GPX file, try opening it in a text editor before loading it onto your device. Understanding what's inside will help you troubleshoot problems, combine routes, and get more out of your navigation tools.