mapy-gpx-exporter
Export GPX files from Mapy.com route planner share
links (mapy.com/s/{id}) — one link or a whole batch, from the command
line or as a Python library.
Why
Mapy.com's web UI lets you export a planned route as GPX, but there's no public API for it and no way to batch-export a list of saved routes. This library reverse-engineers the two requests the "Export → GPX" button makes and wraps them in a clean, typed, tested client.
How it works
- Anonymous Routes:
GET https://mapy.com/s/{id}— Mapy.com replies with a plain HTTP 301 redirect; the full route state (waypoint geometry, routing profile) is embedded in theLocationheader's query string. We decode the proprietaryrcparameter string and re-encode it as absolute chunks toGET https://mapy.com/api/tplannerexport, which returns the GPX file. - Saved Routes (dim links): If the link is a saved route, the geometry is stored server-side. We use
pyfrpcto simulate Mapy.cz's FastRPC routing API (https://mapy.com/api/mapybox-ng/), locally decode the proprietary 5-bit delta-encoded geometry, interpolate elevations, and manually construct the GPX file locally.
This is an unofficial client built against publicly observable network behavior, not a documented or officially supported API. It does not bypass any authentication, paywall, or rate limiting; it only automates the same request an anonymous browser session makes when you click "Export → Save". Endpoint behavior may change without notice — see Limitations.
Install
uv pip install mapy-gpx-exporter
# To support saved routes (dim links), install with the frpc extra:
uv pip install mapy-gpx-exporter[frpc]
CLI usage
# single route
mapy-gpx export https://mapy.com/s/mukekodezu -o route.gpx
# batch: one link per line in links.txt
mapy-gpx batch links.txt --out-dir ./gpx --concurrency 5
Library usage
from mapy_gpx_exporter import MapyGpxClient
with MapyGpxClient() as client:
gpx_bytes = client.fetch_gpx("https://mapy.com/s/mukekodezu")
with open("route.gpx", "wb") as f:
f.write(gpx_bytes)
Batch export, async:
import asyncio
from mapy_gpx_exporter import AsyncMapyGpxClient
async def main():
urls = ["https://mapy.com/s/mukekodezu", "https://mapy.com/s/another"]
async with AsyncMapyGpxClient(max_concurrent=5) as client:
results = await client.fetch_many(urls)
for url, result in results:
if isinstance(result, Exception):
print(f"failed: {url}: {result}")
else:
print(f"ok: {url} ({len(result)} bytes)")
asyncio.run(main())
Limitations
- Only tested against the "planned route" (
turisticka/planner) and activity traces. - No authentication support — routes that require a logged-in session and are strictly private won't export.
- This relies on an undocumented, unofficial endpoint and reverse-engineered formats. Mapy.com can change it at any time without notice.
Development
uv sync --extra dev
uv run pytest
uv run ruff check .
uv run mypy src
uv run pre-commit install
License
MIT
Metadata
Release files for mapy-gpx-exporter 0.1.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 | |
|---|---|---|---|
| mapy_gpx_exporter-0.1.0.tar.gz | 88.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mapy_gpx_exporter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 106.3 kB
Release files / mapy_gpx_exporter-0.1.0.tar.gz
| Download URL | mapy_gpx_exporter-0.1.0.tar.gz |
|---|---|
| Size | 88.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d29ec9153a5329b7e21c5256b6baec69efb9d558e50970b8ad59c3daf27b5781
|
|
BLAKE2b-256 checksum How to use checksums |
31659453ca3cdbc4d3026b80d1d7ec7b45c03ab382c24927a19e46517a40b071
|
| 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 Aug 16, 2026.
Transparency logRelease files / mapy_gpx_exporter-0.1.0-py3-none-any.whl
| Download URL | mapy_gpx_exporter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f846f2937f16228b70bf2c77f90f245e0963206b4495b5c6cf98f3a9f60c0071
|
|
BLAKE2b-256 checksum How to use checksums |
8a69206a8f2ba1d97bc9a116b5f1ddeec7fada6e95f9e624185b5f37956078ed
|
| 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 Aug 16, 2026.
Transparency log