mapy-gpx-exporter
Export GPX files from Mapy.com route and place links — 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
- Map Places: Links such as
https://mapy.com/en/zakladni?source=base&id=...are resolved through Mapy.com's public POI endpoint. The endpoint supplies the place's canonical position (thex/yquery parameters are only viewport coordinates). Object line geometry is decoded into a local GPX track with its segments preserved. When the separate Mapy elevation profile endpoint returns a validated profile, elevations are interpolated onto the track points; otherwise the track remains 2D. Objects without line geometry become a GPX waypoint. - 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
Anonymous route links (rc links) only need the base package:
uv pip install mapy-gpx-exporter
Saved routes (dim links) require the optional FRPC support:
uv pip install "mapy-gpx-exporter[frpc]"
Map places also require the optional FRPC support because Mapy.com's POI endpoint uses FastRPC.
CLI usage
# single route
mapy-gpx export https://mapy.com/s/mukekodezu -o route.gpx
# single map place (decodes its object geometry locally)
mapy-gpx export 'https://mapy.com/en/zakladni?source=base&id=2139764&x=15.6340364&y=49.5820419&z=9' -o place.gpx
# batch: one link per line in links.txt
mapy-gpx batch links.txt --out-dir ./gpx --concurrency 5
Example output:
$ mapy-gpx export https://mapy.com/s/mukekodezu -o route.gpx
Saved route.gpx
Batch filenames are derived safely from each URL's path; query strings and
fragments are ignored. If a filename collides with another route or an
existing file, a deterministic suffix is added (name-2.gpx, name-3.gpx,
and so on), so existing output is never overwritten.
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. source=baseobject links are resolved through Mapy.com's public POI and elevation-profile endpoints. Their line geometry is exported as a track with elevations when the profile is available and validated; objects without line geometry are exported as waypoints.- Route and object links require the optional FRPC support when Mapy.com returns FastRPC data.
- 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.2.1
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.2.1.tar.gz | 96.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mapy_gpx_exporter-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 121.4 kB
Release files / mapy_gpx_exporter-0.2.1.tar.gz
| Download URL | mapy_gpx_exporter-0.2.1.tar.gz |
|---|---|
| Size | 96.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fdbd28155560219e3b2bb16d74087f99f80eb9b215851fb428d1fd8976a4dce
|
|
BLAKE2b-256 checksum How to use checksums |
e3f0108ea7ea890a6d116d2a38c8048f4baac6c9ae5f28c7d4c1bda134fcb505
|
| 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 3, 2026.
Transparency logRelease files / mapy_gpx_exporter-0.2.1-py3-none-any.whl
| Download URL | mapy_gpx_exporter-0.2.1-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d494687d02fb498a6a3c1c9835d7ca974c9e0ff49d1fd36ac724c14ee57e6fb
|
|
BLAKE2b-256 checksum How to use checksums |
64763be008055f54e82164d5ba1b8fc2ece8f4225c432033673914dea6cc9053
|
| 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 3, 2026.
Transparency log