Test files › Geospatial › track.gpx

Sample GPX file (track)

A GPX 1.1 track with timestamped, elevation-tagged track points, plus a waypoint.

↓ Download track.gpx
Filenametrack.gpx
FormatGPX
Size596 bytes (596 bytes)
MIME typeapplication/gpx+xml
SHA-256a33e9e431f34ab79b1c7eb4ae6d1bc4cd59412cfa5eca6dddd6673a5f629dc68
What this file catchesFitness and mapping apps. Includes elevation and ISO-8601 timestamps, so it catches parsers that ignore <ele> or mishandle the timezone on <time>.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

GPX stores lat and lon as attributes; KML writes "lon,lat,alt" text, the opposite order. Read each in its own order and validate the ranges, or points end up swapped across the globe.

import xml.etree.ElementTree as ET

points = []  # (lat, lon)
for el in ET.parse("track.gpx").getroot().iter():
    tag = el.tag.rsplit("}", 1)[-1]
    if tag in ("trkpt", "rtept", "wpt"):  # GPX
        points.append((float(el.get("lat")), float(el.get("lon"))))
    elif tag == "coordinates":  # KML: lon,lat[,alt] tuples
        for t in el.text.split():
            lon, lat = map(float, t.split(",")[:2])
            points.append((lat, lon))
bad = [p for p in points if not (-90 <= p[0] <= 90 and -180 <= p[1] <= 180)]
print(f"{len(points)} points, first at lat {points[0][0]}, lon {points[0][1]}")
print(f"{len(bad)} out of range" if bad else "all within range")

Run against this file, it prints: 4 points, first at lat 51.5072, lon -0.1276 all within range

Related guides and tools

Sample GeoJSON, GPX and KML filesMIME typesVerify its SHA-256

Download & verify

curl -fsSL -o "track.gpx" "https://files.hexaqa.com/geo/track.gpx"
curl -fsSL "https://files.hexaqa.com/geo/track.gpx" | sha256sum # expect: a33e9e431f34ab79b1c7eb4ae6d1bc4cd59412cfa5eca6dddd6673a5f629dc68

More geospatial test files

antimeridian.geojsonmalformed-coords.geojsonplacemarks.kmlpoints.geojson

← All Geospatial files