Skip to main content

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.

example output

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

Examples

# 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

  1. Every .gpx file in the folder is converted to GeoJSON via geojson-transformer.
  2. All tracks are loaded into an in-memory DuckDB database using the spatial extension.
  3. HTML output — renders an interactive lonboard / deck.gl PathLayer map and saves it as a self-contained HTML file.
  4. PNG output — plots the tracks with matplotlib and overlays map tiles via contextily, then saves a high-resolution raster image.

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.

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpx_to_map-0.1.1.tar.gz (122.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gpx_to_map-0.1.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file gpx_to_map-0.1.1.tar.gz.

File metadata

  • Download URL: gpx_to_map-0.1.1.tar.gz
  • Upload date:
  • Size: 122.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gpx_to_map-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f8b2aefa28b86ac98f3fd7ccefda313dfe89ef6b312a2f5c6f432385354ddb66
MD5 7d5566ca443e90436e57e09de2d83a12
BLAKE2b-256 9f63e986bf98a06607d6324b22e95e64af88665b88701efc45ece829d7e3f1a8

See more details on using hashes here.

File details

Details for the file gpx_to_map-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gpx_to_map-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gpx_to_map-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35947c9692cfc97bca5a1074bc47473441927adbb4048444ef6a5138704849f4
MD5 f021969b79a5e295a88c830da61f05ef
BLAKE2b-256 4ccafb9c81c1f734c78fc486ea6cd3f6159d25686cf6c8edb43b871ccca4a7f8

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.1 This release

2 files

0.1.0

2 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