GPX 1.0 Developer's Manual

This Manual is Outdated!

This document applies to GPX 1.0. GPX 1.1 is the current GPX implementation.

Introduction

GPX (the GPS eXchange Format) is a light-weight XML data format for the interchange of GPS data (waypoints, routes, and tracks) between applications and web services on the Internet. This document describes the XML elements defined in GPX in detail and provides examples of their use. The descriptions in this document are designed to help developers interpret the GPX schema, which is the definitive definition of GPX.

Validating your GPX Output

Your application needs to produce valid GPX output before it can be used with other programs and web services that support GPX. As a developer, it is your responsibility to ensure that the GPX data you create validates correctly A GPX file is not a GPX file if it doesn't pass the validator!

XML Namespaces

GPX files should reference at least two namespaces: the XMLSchema namespace, and the GPX namespace. If you include private elements in your GPX files, you need to reference that namespace as well. Here are two examples:

Example using no private elements:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">

Example from ExpertGPS using TopoGrafix 0.2 private elements:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xmlns:topografix="http://www.topografix.com/GPX/Private/TopoGrafix/0/2"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.topografix.com/GPX/Private/TopoGrafix/0/2 http://www.topografix.com/GPX/Private/TopoGrafix/0/2/topografix.xsd">

<gpx> GPX File Organization

All GPX files contain one <gpx> element as the outermost element. <gpx> contains the following:

Required file information in <gpx>

All GPX files must contain the following attributes:

Optional file information in <gpx>

<wpt> Waypoint

<rte> Route

<rtept> Routepoint

<trk> Track

<trkseg> Track Segment

A Track Segment holds a list of Track Points which are logically connected in order. To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new Track Segment for each continuous span of track data.

<trkpt> Trackpoint

Required Attributes

<version>

Required in: <gpx>

<gpx version="0.6" ... >

All GPX files must include the version of the GPX schema which the file references.

<creator>

Required in: <gpx>

<gpx ... creator="EasyGPS 1.1 - www.easygps.com" ... >

All GPX files must include the name of the application or web service which created the file. This is to assist developers in tracking down the source of a mal-formed GPX document, and to provide a hint to users as to how they can open the file.

<lat>

Required in: <wpt> <rtept> <trkpt>

Units: Decimal degrees, WGS84

<wpt lat="42.323" ... >

The latitude of the point.

<lon>

Required in: <wpt> <rtept> <trkpt>

Units: Decimal degrees, WGS84

<wpt ... lon="-71.20453" ... >

The longitude of the point.

Optional Elements

<name>

Optional in: <gpx> <wpt> <rte> <rtept> <trk> <trkpt>

<gpx>: <name>Five Hikes in the White Mountains</name>

<wpt>: <name>MTWASHINGT</name>

<rte>: <name>CRAW PATH</name>

<rtept>: <name>DAVISTRL</name>

In <gpx>: the name of the file.

In all other elements: the GPS name of the element. This field will be transferred to and from the GPS. GPX does not place restrictions on the length of this field or the characters contained in it. It is up to the receiving application to validate the field before sending it to the GPS.

<desc>

Optional in: <gpx> <wpt> <rte> <rtept> <trk> <trkpt>

<gpx>: <desc>Five Hikes in the White Mountains</desc>

<wpt>: <desc>Mount Washington</desc>

<rte>: <desc>Crawford Path Hike</desc>

<rtept>: <desc>Junction with Davis Trail</desc>

A text description of the element. Holds additional information about the element intended for the user, not the GPS.

<author>

Optional in: <gpx>

<author>Dan Foster</author>

The author of the GPX file. The GPX file's owner/creator.

<email>

Optional in: <gpx>

<email>danfoster95@yahoo.com</email>

Email address associated with the GPX file. Usually contact email address of the GPX file's author.

<url>

Optional in: <gpx> <wpt> <rte> <rtept> <trk> <trkpt>

<url>www.mountwashington.org/</url>

URL associated with the element. Webpage or additional info connected to element.

<urlname>

Optional in: <gpx> <wpt> <rte> <rtept> <trk> <trkpt>

<urlname>Visit my New Hampshire hiking website!</urlname>

Hyperlink text associated with the URL.

<time>

Optional in: <gpx> <wpt> <rte> <rtept> <trk> <trkpt>

<time>2002-02-10T21:01:29.250Z</time>

Creation/modification timestamp for element. Date and time in are in Univeral Coordinated Time (UTC), not local time! Conforms to ISO 8601 specification for date/time representation. Fractional seconds are allowed for millisecond timing in tracklogs.

<keywords>

Optional in: <gpx>

<keywords>Hiking, NH, Presidential Range</keywords>

Keywords for indexing the GPX file with search engines. Comma separated.

<bounds>

Optional in: <gpx>

<bounds minLat="42.1" minlon="-71.9" maxLat="42.4" maxlon="-71.1" />

Bounding rectangle of all data in GPX file. Allows indexing by geographic extent.

Position Information

<ele>

Optional in: <wpt> <rtept> <trkpt>

Units: meters

<ele>1206.2</ele>

Elevation in meters of the point.

<course>

Optional in: <wpt> <rtept> <trkpt>

Units: degrees, true

<course>45.2</course>

Instantaneous course at the point.

<speed>

Optional in: <wpt> <rtept> <trkpt>

Units: meters per second

<speed>4.23</speed>

Instantaneous speed at the point.

<magvar>

Optional in: <wpt> <rtept> <trkpt>

Units: degrees

<magvar>-16.2</magvar>

Magnetic variation at the point.

<geoidheight>

Optional in: <wpt> <rtept> <trkpt>

Units: meters

<geoidheight>-16.2</geoidheight>

Height, in meters, of geoid (mean sea level) above WGS-84 earth ellipsoid. (NMEA GGA message)

<cmt>

Optional in: <wpt> <rte> <rtept> <trk> <trkpt>

<cmt>MT WASHINGTON</cmt>

GPS waypoint comment. Sent to GPS as comment.

<src>

Optional in: <wpt> <rte> <rtept> <trk> <trkpt>

<src>Garmin eTrex Venture</src>

<src>USGS Mount Washington 7.5 Quad</src>

Source of data. Included to give user some idea of reliability and accuracy of data.

<sym>

Optional in: <wpt> <rtept> <trkpt>

<sym>Scenic Area</sym>

Text of GPS symbol name. For interchange with other programs, use the exact spelling of the symbol on the GPS, if known.

<type>

Optional in: <wpt> <rtept> <trkpt>

<type>Hiking trail</type>

Type (classification) of element.

<fix>

Optional in: <wpt> <rtept> <trkpt>

<fix>2d</fix>

Type of GPX fix.

    Must be one of:
  • none No fix
  • 2d position only
  • 3d position and elevation
  • dgps DGPS
  • pps Military signal used

To represent "fix type unknown", leave out fix entirely.

<sat>

Optional in: <wpt> <rtept> <trkpt>

<sat>8</sat>

Number of satellites used to calculate the GPS fix. (not number of satellites in view).

<hdop>

Optional in: <wpt> <rtept> <trkpt>

<hdop>1.4</hdop>

Horizontal dilution of precision.

<vdop>

Optional in: <wpt> <rtept> <trkpt>

<vdop>3.2</vdop>

Vertical dilution of precision.

<pdop>

Optional in: <wpt> <rtept> <trkpt>

<pdop>1.4</pdop>

Position dilution of precision.

<ageofdgpsdata>

Optional in: <wpt> <rtept> <trkpt>

<ageofdgpsdata>21</ageofdgpsdata>

Number of seconds since last DGPS update.

<dgpsid>

Optional in: <wpt> <rtept> <trkpt>

<dgpsid>142</dgpsid>

ID of DGPS station used in differential correction.

<number>

Optional in: <rte> <trk>

<number>2</number>

GPS slot number for element.

GPX Home