What Is GPX and How Does It Structure GPS Data?

GPX, or the GPS Exchange Format, is an open-standard XML data format designed to share and store GPS data across applications, web services, and GPS devices. This article explains the fundamentals of the GPX format and breaks down how it organizes location coordinates—specifically individual waypoints and recorded tracks—using standardized XML schemas.


What Is GPX?

GPX is a lightweight XML specification for transferring geographic data. Because it is based on standard XML (Extensible Markup Language), GPX files are human-readable plain text files that can be parsed, edited, and rendered by virtually any modern GPS software, mapping application, or text editor.

A standard GPX file wraps all geographic data within a top-level root tag:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Device or App Name" xmlns="http://www.topografix.com/GPX/1/1">
  <!-- Metadata, Waypoints, Routes, and Tracks go here -->
</gpx>

How GPX Structures Waypoints

A waypoint represents a specific point of interest, landmark, or standalone coordinate with no direct chronological connection to other points. In GPX, waypoints are defined using the <wpt> tag.

The <wpt> element uses attributes to define coordinates in decimal degrees (WGS 84 datum): * lat: Latitude * lon: Longitude

Child elements within <wpt> provide additional context: * <ele>: Elevation in meters. * <time>: Coordinated Universal Time (UTC) timestamp in ISO 8601 format. * <name>: The display name of the waypoint. * <desc>: A text description. * <sym>: The icon or symbol name used to render the point on a map.

Example of a GPX Waypoint:

<wpt lat="37.7749" lon="-122.4194">
  <ele>15.2</ele>
  <time>2023-10-01T12:00:00Z</time>
  <name>San Francisco Landmark</name>
  <desc>A scenic viewpoint marker.</desc>
  <sym>Scenic Area</sym>
</wpt>

How GPX Structures Tracks

A track represents an actual path or journey recorded by a GPS device. Unlike waypoints, track points are ordered, sequential, and intended to show a continuous movement path.

The GPX track structure uses a three-level hierarchy:

  1. <trk> (Track): The main container for the recorded path, typically holding a <name> and optional metadata.
  2. <trkseg> (Track Segment): A grouping within a track that holds continuous track points. If GPS reception drops and recovers, a new segment might be created to prevent drawing an uninterrupted straight line across the gap.
  3. <trkpt> (Track Point): The individual coordinate element within a segment. Like <wpt>, it uses lat and lon attributes, but heavily relies on <ele> and <time> to calculate speed, pace, and vertical gain.

Example of a GPX Track:

<trk>
  <name>Morning Run</name>
  <trkseg>
    <trkpt lat="37.7749" lon="-122.4194">
      <ele>15.2</ele>
      <time>2023-10-01T08:00:00Z</time>
    </trkpt>
    <trkpt lat="37.7752" lon="-122.4190">
      <ele>16.0</ele>
      <time>2023-10-01T08:00:15Z</time>
    </trkpt>
    <trkpt lat="37.7756" lon="-122.4185">
      <ele>17.1</ele>
      <time>2023-10-01T08:00:30Z</time>
    </trkpt>
  </trkseg>
</trk>

Key Differences: Waypoints vs. Tracks