Skip to main content

mapy-gpx-exporter

CI

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

  1. 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 (the x/y query parameters are only viewport coordinates). Object line geometry is decoded into a local GPX track with its segments preserved; objects without line geometry become a GPX waypoint.
  2. 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 the Location header's query string. We decode the proprietary rc parameter string and re-encode it as absolute chunks to GET https://mapy.com/api/tplannerexport, which returns the GPX file.
  3. Saved Routes (dim links): If the link is a saved route, the geometry is stored server-side. We use pyfrpc to 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=base object links are resolved through Mapy.com's public POI endpoint. Their line geometry is exported as a track; 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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mapy-gpx-exporter 0.2.0
File Size Uploaded
mapy_gpx_exporter-0.2.0.tar.gz 95.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mapy-gpx-exporter 0.2.0
File Interpreter ABI Platform
mapy_gpx_exporter-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 118.0 kB

Release files / mapy_gpx_exporter-0.2.0.tar.gz

Download URL mapy_gpx_exporter-0.2.0.tar.gz
Size 95.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a8b77c671b2520af604870f1fb0779b9ec8a4ec4edc06951600764095e0ccb1f
BLAKE2b-256 checksum
How to use checksums
fd7a95878782de2a7590aa188550c97c6f3ea8d3bf2c7442e02b85c95605446a
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

Release files / mapy_gpx_exporter-0.2.0-py3-none-any.whl

Download URL mapy_gpx_exporter-0.2.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9cbaa60b9777f3022269544f4cfe346a1f7b630bac96643758bc91aa8bfa00e6
BLAKE2b-256 checksum
How to use checksums
44b3f0c9b8e16968aabb62cde97e82c460b60cca48482d43c233582ae97fff1d
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

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page