fastgpx
An experimental Python library for parsing GPX files fast.
# Get the total length of the tracks in a GPX file:
import fastgpx
gpx = fastgpx.load("example.gpx")
print(f'{gpx.length_2d()} m')
# Iterate over GPX file:
import fastgpx
gpx = fastgpx.load("example.gpx")
for track in gpx.tracks:
print(f'Track: {track.name}')
print(f'Distance: {track.length_2d()} m')
time_bounds = track.time_bounds()
if not time_bounds.is_empty():
print(f'Time: {time_bounds.start_time} - {time_bounds.end_time}')
for segment in track.segments:
for point in segment.points:
print(f'Point: {point.latitude}, {point.longitude}')
import fastgpx
locations = [
fastgpx.LatLong(64, 10),
fastgpx.LatLong(66, 11),
]
encoded = fastgpx.polyline.encode(locations, precision=6)
decoded = fastgpx.polyline.decode(encoded, precision=6)
Requirements
- Python 3.12+ (Tested with 3.12, 3.13, 3.14)
- C++23 Compiler (For building
fastgpx)
Windows
- Tested with MSVC 17.12.4+ and Clang-cl 19+.
Linux (Tested on Ubuntu)
- C++23 compatible runtime (GCC libstdc++ 14+ or Clang libc++ 18.1+)
GPX/XML Performance (Background)
This library came out of the need to extract information from many GPX files fast.
gpxpy is the most popular GPX library for Python. It is very versatile in manipulating GPX files.
However in benchmarking it doesn't perform well.
gpxpy docs says (at time of writing) that it uses lxml is available because it is faster than
"minidom" (etree).
When benchmarking that was not the case. It appear that the stdlib XML library has gotten much
better since gpxpy was created.
Reference: Open ticket on making etree default:
https://github.com/tkrajina/gpxpy/issues/248
fastgpx is not intended as a replacement for gpxpy. It mainly focuses on extracting GPX data
fast for performance critical tasks. For the few functionalities that does overlap with gpxpy
compatible method calls has been added so that one can quickly swap between fastgpx and gpxy.
Benchmarks
Test machine: AMD Ryzen 7 5800X, 32 GB memory, Windows 11, and WSL2 Ubuntu 24.04 on the same machine. Python 3.12, fastgpx 0.8.0, gpxpy 1.6.2, lxml 6.1.3, polyline 2.0.4.
Total track length
Total track length of gpx/2024 Great Roadtrip (24 files, 330k points), in seconds per pass.
Lower is better.
| Method | Windows | Linux |
|---|---|---|
| gpxpy | 13.3 | 11.7 |
xml.etree + gpxpy.geo distance |
0.700 | 0.610 |
lxml + gpxpy.geo distance |
0.892 | 0.593 |
fastgpx (load + length_2d) |
0.159 | 0.0538 |
gpxpy's and fastgpx's lengths differ by 0.08%, because they use different distance formulas.
Polyline encoding
Encoding every segment of the same files, in seconds per pass. Both timings include loading the files with fastgpx.
| Method | Windows | Linux |
|---|---|---|
fastgpx.polyline.encode |
0.155 | 0.0464 |
polyline.encode |
0.655 | 0.411 |
Reproducing
uv run --group benchmarks benchmarks/benchmark_gpx.py
uv run --group benchmarks benchmarks/benchmark_polyline.py
benchmark_gpx.py prints each method's time per pass as "Average"; gpxpy runs once.
benchmark_polyline.py prints the total for 10 passes, so divide it by 10 to compare with the
table.
Detailed performance notes are in benchmarks/README.md.
Release files for fastgpx 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastgpx-0.8.0.tar.gz | 209.1 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fastgpx-0.8.0-cp312-abi3-win_arm64.whl | CPython 3.12 | abi3 | Windows ARM64 | Details |
| fastgpx-0.8.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| fastgpx-0.8.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
| fastgpx-0.8.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 | Details |
Total release size: 1.4 MB
Release files / fastgpx-0.8.0.tar.gz
| Download URL | fastgpx-0.8.0.tar.gz |
|---|---|
| Size | 209.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
147f24d2dc64d9f855b27f70f535e10631cd721f0166dd87ca34e563714b8a4b
|
|
BLAKE2b-256 checksum How to use checksums |
bc467c856f2637813d3306812089fe56bd8e91ce9ba14578f82f9847d58ba687
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / fastgpx-0.8.0-cp312-abi3-win_arm64.whl
| Download URL | fastgpx-0.8.0-cp312-abi3-win_arm64.whl |
|---|---|
| Size | 194.8 kB |
| Tags | CPython 3.12 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
13d402f81f49840c2d63fdd834e56694405920f7614683fc0050b54801260bab
|
|
BLAKE2b-256 checksum How to use checksums |
dcf2ce051f7933c20fa04c772ebc93281d330eba1b1be88f0cfab5c0a3b2cf64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / fastgpx-0.8.0-cp312-abi3-win_amd64.whl
| Download URL | fastgpx-0.8.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 202.8 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e5ec958bffc71bef6098eebbde2036e9f0f8dc34804442858dae025fb3ea350e
|
|
BLAKE2b-256 checksum How to use checksums |
0fc6552044043c9bcda02657d9fc5b26509f760514ac38e084b001ba1faff62a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / fastgpx-0.8.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fastgpx-0.8.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 409.1 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ddf279caa3e745234660817e42dc7c43b033d3def391dd435019f7f2b3bb3a2a
|
|
BLAKE2b-256 checksum How to use checksums |
695054c66b4724944f5e4a92cb579eb904530551e439308110964e2f34bee152
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / fastgpx-0.8.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | fastgpx-0.8.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 370.7 kB |
| Tags | CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3fca54b13d5c2a9577b5d83fb6a7ff92e6b572c0df6320a25b9bb4253766b926
|
|
BLAKE2b-256 checksum How to use checksums |
6dcade5f85df7856e07ec771f75898f36450a1b6deaa5482fcb2696c4a044c6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log