skillfed

gpxpy

GPX file parser and GPS track manipulation library

gpxpy v1.6.2 524.6K downloads/30d#6,188 on PyPI1,107
Permissive license Apache License, Version 2.0 DORMANT released

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 gpxpy

uv

uv add gpxpy

poetry

poetry add gpxpy

Installing 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

Programming Language :: PythonProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8

Tags

gpx file parsergps track parsinggpx manipulation libraryparse gps coordinatestrack waypoint editorxml gps formatgpx to python objects
gps-geolocationxml-parsingdata-format

More Utilities packages