Skip to main content

mapstyle

mapstyle

A whole OpenStreetMap map in one offline HTML page:
the roads for driving, walking and cycling over a full base map, from one duckOSM database.

PyPI CI Docs Python 3.10+ License MIT

Documentation · Live map · Get started · Gallery · JavaScript API


Monaco drawn by mapstyle: streets, paths, buildings, parks, the port and the sea

Quick start

pip install mapstyle "duckosm @ git+https://github.com/Khoshkhah/duckOSM"

curl -LO https://download.geofabrik.de/europe/monaco-latest.osm.pbf
duckosm build --pbf monaco-latest.osm.pbf -o monaco.duckdb \
              -m driving -m walking -m cycling
mapstyle monaco.duckdb          # -> monaco_all.html: one file, opens offline
import mapstyle as ms

ms.render_map("monaco.duckdb").save("monaco.html")                    # the whole map
ms.render_map("monaco.duckdb", mode="walking", paths="komoot")        # paths in front
ms.render_map("monaco.duckdb", theme="grey")                          # a quiet map for data
ms.render_map("monaco.duckdb", planner=True).save("planner.html")     # a route planner demo
ms.render_map("monaco.duckdb", dashboard=True).save("dashboard.html") # a dashboard

What you get

  • Every travel mode on one map, or one brought to the front: all, driving, walking, cycling; four looks for paths (google, osm, komoot, cyclosm); and three themes for the whole map: osm (detailed), google (clean), grey (quiet, for your data on top).
  • A full base map from the same database: the sea, land use with openstreetmap.org's textures, water, buildings, railways, parking, transit, traffic lights and crossings. No tile server, no API key.
  • Roads drawn right at junctions: two-way roads as two lanes, bridges and overpasses over, tunnels under, a footway or crossing never over a street; zebra crossings and traffic lights are drawn over their street, at its level, so on a bridge or in a tunnel they follow it. The drawing order of the roads is roadstyle's: a casing number and a fill number for every road, read from the database when duckosm levels stored them, else computed while the page is made, so a joint of roads at different levels shows no ring.
  • A route planner demo: drag a start and an end and see duckOSM's route on the map (routing itself is duckOSM's job).
  • A dashboard: filter by mode, road class and layer, colour by mode, inspect what you click.
  • A JavaScript API: every page is a roadstyle page (rsQuery, rsFilter, rsColor, …) plus rsSetModes, rsSetKinds, rsSetInteraction and rsSetBuildings3D; 3D, Street View and vector tiles for large areas come with it.
The walking mode
Walking: paths in front
A raised walkway over a roundabout
A raised walkway over a roundabout
The route planner
The route planner demo
The dashboard
The dashboard

How it fits together

Project Its part
duckOSM OpenStreetMap → one DuckDB file: the driving, walking and cycling networks and the base-map layers
mapstyle reads that file (with duckdb only) and styles all of it as one map
roadstyle draws the page: MapLibre GL, the road styling, the JavaScript API

The look is data: four YAML files in src/mapstyle/styles/ (travel modes, path styles, colours, layers). See Styles.

Command line

mapstyle DB [-o OUT] [--mode {all,driving,walking,cycling}] [--paths {google,osm,komoot,cyclosm}]
            [--theme {osm,google,grey}]
            [--no-layers] [--planner] [--dashboard] [--tiles] [--basemap BASEMAP]

For AI agents

  • Using mapstyle: the agent skill skills/mapstyle/SKILL.md has the install, the one call, the options, the JavaScript API and the traps in one page. In Claude Code: /plugin marketplace add Khoshkhah/mapstyle, then /plugin install mapstyle@mapstyle.
  • The docs as text: llms.txt and llms-full.txt (every page, one file).
  • Changing mapstyle: AGENTS.md has the commands and the project's rules.

More: AI agents.

Development

git clone https://github.com/Khoshkhah/mapstyle && cd mapstyle
python -m venv .venv && .venv/bin/pip install -e ".[dev,tiles]"
.venv/bin/pytest          # builds a Monaco database with a duckOSM checkout next to this one

Tests look for duckOSM in ../duckOSM (with its .venv), or wherever DUCKOSM_DIR / DUCKOSM_EXE point; MAPSTYLE_TEST_DB reuses a database you already built. Design notes are in docs/design/.

License

MIT. Map data © OpenStreetMap contributors (ODbL); the sea from Overture Maps, built from OpenStreetMap's coastline.

Metadata

Release files for mapstyle 0.7.1

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

Source distribution (sdist)

Source distribution for mapstyle 0.7.1
File Size Uploaded Provenance Actions
mapstyle-0.7.1.tar.gz 69.6 kB With provenance Details for mapstyle-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mapstyle 0.7.1
File Interpreter ABI Platform Actions
mapstyle-0.7.1-py3-none-any.whl Python 3 none any Details for mapstyle-0.7.1-py3-none-any.whl

Total release size: 130.5 kB

Release files / mapstyle-0.7.1.tar.gz

Download URL mapstyle-0.7.1.tar.gz
Size 69.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c839d080df9c9366152f6d85ec4fb37f04790d2123826bb2cec71658cd9128cb
BLAKE2b-256 checksum
How to use checksums
eb2dfb8c0cb62f02d8dff9957ff5b0c91b7f2923203dfa307ced912ef6390c80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / mapstyle-0.7.1-py3-none-any.whl

Download URL mapstyle-0.7.1-py3-none-any.whl
Size 60.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c94573293d859a9f5aea3218bcd38bc2199a7bf0cb405d52d1074643c1f55f9e
BLAKE2b-256 checksum
How to use checksums
2fabcbeacfc30845cb730209278923945f5fa66f7f0ae76fe7b5c0d266f87a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Security for mapstyle 0.7.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mapstyle-0.7.1.tar.gz

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 Oct 21, 2026.

Transparency log

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.

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