gpx-to-map
Convert a folder of GPX tracks into an interactive HTML map (lonboard / deck.gl) or a static PNG image (matplotlib + contextily) with a single command.
Installation
pip install gpx-to-map
Usage
gpx-to-map <gpx-folder> <output-file> [OPTIONS]
| Argument | Description |
|---|---|
gpx-folder |
Directory containing .gpx files |
output-file |
Destination path — .html for interactive, .png for static |
Options
| Option | Default | Description |
|---|---|---|
--style / -s |
dark |
Background map style: dark, light, voyager |
--color / -c |
red |
Track color — any matplotlib name, hex (#1f77b4), or CSS color |
--highlight-latest / --no-highlight-latest |
disabled | Highlight the most recent track with a contrasting accent color. Recency is determined by the first trackpoint timestamp in each GPX file, falling back to file modification time |
--geojson-folder |
(discard) | Keep intermediate GeoJSON files in this folder (created if absent) |
--dpi |
200 |
Resolution for PNG output in dots per inch; ignored for HTML |
--show-names / --no-show-names |
off | Show place-name labels on dark/light HTML basemaps (hidden by default; voyager always shows them); ignored for PNG |
--detail |
1 |
Extra basemap zoom levels for PNG sharpness (0 = library default, higher = sharper but slower); ignored for HTML |
Examples
Let's assume you have a folder of gpx files ./rides.
# Interactive map with default dark style
gpx-to-map ./rides output.html
# Light basemap, steelblue tracks, highlight the latest ride
gpx-to-map ./rides output.html --style light --color steelblue
# Export a static PNG instead
gpx-to-map ./rides output.png --style voyager --color "#e07b39"
# Don't highlight the latest track
gpx-to-map ./rides output.html --no-highlight-latest
How it works
- Every
.gpxfile in the folder is converted to GeoJSON viageojson-transformer. - All tracks are loaded into an in-memory DuckDB database using the
spatialextension. - HTML output — renders an interactive lonboard / deck.gl
PathLayermap over an OpenFreeMap vector basemap (MapLibre GL) and saves it as a self-contained HTML file. On thedarkandlightstyles the basemap's place-name labels are stripped by default (pass--show-namesto keep them). - PNG output — plots the tracks with matplotlib and overlays no-key Esri raster tiles via contextily (fetched one zoom level deeper than the default for sharpness — tunable with
--detail), then saves a high-resolution raster image. Thedarkstyle darkens the tiles toward black so the tracks stand out.
The latest GPX file is always loaded into a separate layer so it can be highlighted. "Latest" is determined by the timestamp of the first trackpoint (<trkpt><time>) recorded in the file; files without trackpoint timestamps (e.g. manually-planned routes) fall back to their filesystem modification time.
Basemaps & attribution
HTML maps use free, no-API-key vector basemaps from OpenFreeMap. OpenFreeMap is run as a public good with no usage limits — if you find it useful, please support it via GitHub Sponsors.
PNG maps use no-key raster tiles from Esri. Keep the on-map attribution visible in anything you publish.
Python API
create_map can be called directly from Python without the CLI:
from pathlib import Path
from gpx_to_map.core import create_map
create_map(
gpx_folder=Path("./rides"),
output_file=Path("output.html"), # or "output.png" for a static image
style="dark", # "dark" | "light" | "voyager"
color="steelblue",
highlight_latest=True,
geojson_folder=Path("./geojson"), # optional: keep intermediate GeoJSON files
)
All parameters correspond directly to the CLI options. style accepts the same string values as --style.
Development
git clone https://codeberg.org/marioangst/gpx-to-map
cd gpx-to-map
uv sync
uv run gpx-to-map --help
Metadata
Release files for gpx-to-map 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| gpx_to_map-0.2.0.tar.gz | 126.7 kB | Without provenance | Details for gpx_to_map-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gpx_to_map-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for gpx_to_map-0.2.0-py3-none-any.whl |
Total release size: 141.2 kB
Release files / gpx_to_map-0.2.0.tar.gz
| Download URL | gpx_to_map-0.2.0.tar.gz |
|---|---|
| Size | 126.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a14bf0846f2829f4f6f8f8ba375a1d510880de0459a2138eee8a5afbc1634a21
|
|
BLAKE2b-256 checksum How to use checksums |
737ddbcacbc1e8717c659e3d345b40dc8d517e0219a1b05f9988490f4f21d9bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"21.3","id":"virginia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gpx_to_map-0.2.0-py3-none-any.whl
| Download URL | gpx_to_map-0.2.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1662fc83e3bd736445dafb375163bb3fe01f367ffcc9894b39ac10166edeebcb
|
|
BLAKE2b-256 checksum How to use checksums |
06fa8301dc0c682f96290a564e44c3df99e8548e710a002a30f462afa7564cc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"21.3","id":"virginia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for gpx-to-map 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.