Structure of a GPX File
A GPX file stores geographic data such as waypoints, routes and tracks. GPX stands for GPS Exchange Format. The format is based on XML and is often used to exchange GPS data between map apps, web services and GPS devices.
Tags, Elements, Attributes and Values
A GPX file consists of elements. An element is a complete section in the XML code. It usually consists of a start tag, content and an end tag:
<name>Munich</name>
In this example, <name> is the start tag, </name> is the end tag and Munich is the value of the element.
Elements can also contain other elements. For a waypoint (wpt), for example, name and ele can be given as subelements:
<wpt lat="48.137154" lon="11.576124">
<name>Munich</name>
<ele>519</ele>
</wpt>
Some information is not stored as a separate subelement in the file, but directly in the start tag. This information is called attributes. For GPX points, the attributes for latitude and longitude are especially important: lat and lon.
<wpt lat="48.137154" lon="11.576124"></wpt>
In this example, wpt is the element for the waypoint. lat and lon are attributes of the waypoint. name and ele are subelements. Munich and 519 are the values of these subelements.
Simple Example
At its core, a GPX file is a text file with an XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="MapifyGPX">
<wpt lat="48.137154" lon="11.576124">
<name>Munich</name>
<desc>Example waypoint</desc>
</wpt>
<rte>
<name>Example route</name>
<rtept lat="48.137154" lon="11.576124">
<name>Starting point</name>
</rtept>
<rtept lat="48.208174" lon="16.373819">
<name>Destination point</name>
</rtept>
</rte>
<trk>
<name>Example track</name>
<trkseg>
<trkpt lat="48.137154" lon="11.576124">
<ele>519</ele>
<time>2026-01-01T10:00:00Z</time>
</trkpt>
<trkpt lat="48.138000" lon="11.578000">
<ele>521</ele>
<time>2026-01-01T10:01:00Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>
The Most Important GPX Elements
| Element | Meaning |
|---|---|
gpx |
root element of the GPX file |
metadata |
general information about the file |
wpt |
waypoint, i.e. a single location or marker |
rte |
route, i.e. a planned sequence of points |
rtept |
single point within a route |
trk |
track, i.e. a recorded or detailed route path |
trkseg |
track segment within a track |
trkpt |
single point within a track segment |
extensions |
area for additional information from apps or GPS devices |
Coordinates as Attributes: lat and lon
For GPX points, the coordinates are written directly as attributes in the respective point element.
| Attribute | Meaning | Format / Unit | Allowed in |
|---|---|---|---|
lat |
geographic latitude | decimal degrees, WGS84 | wpt, rtept, trkpt |
lon |
geographic longitude | decimal degrees, WGS84 | wpt, rtept, trkpt |
These attributes must be set in wpt, rtept and trkpt, so they are required information. Without these coordinates, a point cannot be clearly displayed on a map.
Optional Information
In addition to the required attributes lat and lon, GPX files can contain many other pieces of information. This information is optional and is usually given as subelements.
For a waypoint, for example, the elevation can be stored as the subelement ele:
<wpt lat="48.137154" lon="11.576124">
<ele>519</ele>
</wpt>
GPX uses metric units. Elevation values such as ele and geoidheight are therefore given in meters. ageofdgpsdata is given in seconds. Coordinates such as lat and lon are stored in decimal degrees.
| Information | Meaning | Format / Unit | Allowed in |
|---|---|---|---|
ele |
elevation | meters | wpt, rtept, trkpt |
time |
timestamp | date/time, e.g. 2026-01-01T10:00:00Z |
metadata, wpt, rtept, trkpt |
magvar |
magnetic variation | degrees | wpt, rtept, trkpt |
geoidheight |
geoid height | meters | wpt, rtept, trkpt |
name |
name of the element | text | metadata, wpt, rte, rtept, trk, trkpt |
cmt |
comment | text | wpt, rte, rtept, trk, trkpt |
desc |
description | text | metadata, wpt, rte, rtept, trk, trkpt |
src |
data source / origin | text | wpt, rte, rtept, trk, trkpt |
link |
additional link | link element | metadata, wpt, rte, rtept, trk, trkpt |
sym |
display symbol | text | wpt, rtept, trkpt |
type |
type or classification | text | wpt, rte, rtept, trk, trkpt |
fix |
type of position fix | none, 2d, 3d, dgps or pps |
wpt, rtept, trkpt |
sat |
number of satellites used | integer | wpt, rtept, trkpt |
hdop |
horizontal accuracy value | decimal number | wpt, rtept, trkpt |
vdop |
vertical accuracy value | decimal number | wpt, rtept, trkpt |
pdop |
spatial accuracy value | decimal number | wpt, rtept, trkpt |
ageofdgpsdata |
age of the last DGPS data | seconds | wpt, rtept, trkpt |
dgpsid |
ID of the DGPS station used | integer from 0 to 1023 |
wpt, rtept, trkpt |
number |
number of a route or track | integer | rte, trk |
keywords |
keywords for the file | text | metadata |
bounds |
geographic area of the file | coordinate range | metadata |
author |
author of the file | author element | metadata |
copyright |
copyright information | copyright element | metadata |
extensions |
additional information from apps or devices | extension | gpx, metadata, wpt, rte, rtept, trk, trkseg, trkpt |
Is This All Allowed Information?
For GPX 1.1, the information listed above is the most important standardized information that commonly occurs in normal GPX files.
However, there can be additional information. For this, the extensions element exists. Apps, web services or GPS devices can use it to store their own information. Such extensions are not part of the general core of GPX and are not supported equally by every application.
What Is This Useful For?
GPX files are useful because they can be read by many map apps, GPS devices and outdoor programs. This makes it easy to exchange waypoints, routes and tracks between different applications.
MapifyGPX, for example, extracts the coordinates (lat and lon) from a GPX file and uses them to create links to Google Maps and Apple Maps.