gpxpy
GPX file parser and GPS track manipulation library
What it is and what it does
gpxpy is a Python library for reading, writing, and manipulating GPX files—the standard XML format for GPS tracks, routes, and waypoints. It abstracts the GPX schema into Python objects (tracks, segments, points, waypoints, routes) that you can parse from files, modify programmatically, and serialize back to valid XML. The library handles both GPX 1.0 and 1.1 versions automatically, preserves extensions, and provides utility methods for calculating statistics like distance and speed while filtering out common GPS errors.
It has no external runtime dependencies and installs as a pure Python wheel, making it lightweight and portable. The library is mature (first released 2012-03-21) and widely adopted, though maintenance is dormant—the last release was 2023-11-29. It supports Python 3.6 and later, with optional use of lxml for faster XML parsing if available.
Use it for:
- Parse GPS track files from fitness devices or mapping applications to extract and analyze coordinate, elevation, and timing data.
- Build a GPS track editor or organizer that reads GPX, modifies waypoints or segments, and writes the result back to file.
- Calculate statistics from GPS tracks (distance, speed, elevation gain) with built-in heuristics to filter GPS noise.
- Convert between GPX 1.0 and 1.1 formats or add custom extensions to GPX documents for application-specific metadata.
- Programmatically generate GPX files from coordinate data (e.g., from a route planner or survey tool).
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses, manipulates, and generates GPX files (XML-based GPS track format), supporting both GPX 1.0 and 1.1 with track, route, waypoint, and segment management.
Yes. gpxpy is a stable, dependency-free parser for a standard format with strong adoption. Dormant maintenance is acceptable here because GPX is a stable XML schema unlikely to change; the repository remains active. Install it if you need to read, write, or manipulate GPS tracks in Python.
Install
gpxpy on PyPI
pip
pip install gpxpyuv
uv add gpxpypoetry
poetry add gpxpyInstalling gpxpy
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is dormant (last release 2023-11-29, 989 days ago), but the repository remains active with recent commits.
License in practice
Apache License, Version 2.0 is permissive, allowing commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
import gpxpy
import gpxpy.gpx
# Parse an existing GPX file
gpx_file = open('track.gpx', 'r')
gpx = gpxpy.parse(gpx_file)
# Access tracks, waypoints, routes
for track in gpx.tracks:
for segment in track.segments:
for point in segment.points:
print(f'({point.latitude}, {point.longitude})')
# Create and serialize new GPX
gpx_new = gpxpy.gpx.GPX()
gpx_track = gpxpy.gpx.GPXTrack()
gpx_new.tracks.append(gpx_track)
print(gpx_new.to_xml())
Requires Python 3.6 or later. Optional: lxml library for faster XML parsing; minidom is used as fallback.
Verify before relying
- Whether lxml is automatically installed or must be added separately for the performance improvement mentioned
- Current test coverage and whether the dormant status indicates stability or potential compatibility issues with newer Python versions
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 989 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 524,634/month — #6,188 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gpxpy-1.6.2-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
fit-toolReads and writes Garmin FIT files for Activity,…
permissive · top 15,000 on PyPI
gps3Provides Python clients to connect to a GPSD…
permissive · top 15,000 on PyPI
dicttoxmlConverts Python dictionaries and other native…
copyleft · top 5,000 on PyPI
xmltodictConverts XML to Python dictionaries and back,…
permissive · top 1,000 on PyPI
svgpathtoolsReads, writes, and analyzes SVG Path objects…
permissive · top 5,000 on PyPI
pynmeagpsParses and generates NMEA 0183 GPS/GNSS…
permissive · top 15,000 on PyPI
pykmlpyKML parses and creates KML documents using a…
permissive · top 15,000 on PyPI
pyrtcmParses RTCM3 differential GNSS protocol…
permissive · top 15,000 on PyPI
fastkmlReads, writes, and manipulates KML files—an…
copyleft · top 15,000 on PyPI
xmlunittestExtends Python's unittest framework to compare…
permissive · top 5,000 on PyPI