roadstyle

io.github.Khoshkhah由 GitHub 帳號 Khoshkhah 發布v0.29.0更新於 Nov 8, 2026

Styled, interactive road maps of any place (OpenStreetMap) or road file, with PNG previews.

概覽

AI 產生的概覽

把任意地點或道路檔案繪製成帶樣式的互動式離線 HTML 道路地圖,並產生可供助理查看的 PNG 預覽。

可以做什麼
  • 繪製地點:下載指定地點的 OpenStreetMap 道路資料並存成互動式 HTML 地圖
  • 繪製檔案:把 GeoPackage、GeoJSON、Shapefile 等資料中的道路邊繪製成 HTML 地圖
  • 設定樣式:依資料欄位上色、選擇配色與底圖、篩選道路類型、開啟 3D 橋面
  • 對已儲存的地圖擷取 PNG 快照,可指定中心經緯度與縮放層級
適用情境
需要快速取得城市或城區的美觀道路地圖,或把自己的路網資料視覺化,又不想撰寫製圖程式碼時使用。也適合透過回傳的預覽圖核對街道名稱、單行道箭頭與上色效果。
執行需求
透過 uvx 從 PyPI 套件 roadstyle-mcp 以 stdio 方式在本機執行。繪製地點需要連線至 OpenStreetMap。產生 PNG 預覽需先用 Playwright 安裝一次 Chromium。選用環境變數 CARTO_API_KEY 可啟用 CARTO 底圖,未設定時使用免金鑰的 Esri 街道底圖。地圖會存放在使用者家目錄下的資料夾。
安裝前請注意
繪製地點會下載 OpenStreetMap 資料,縣域等大範圍可能耗時數分鐘。選用的 CARTO_API_KEY 屬於機密,應避免寫入共用檔案。伺服器會將 HTML 與 PNG 檔案寫入磁碟。產生的頁面可能包含 Google 街景,瀏覽行為會傳送給 Google。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 roadstyle,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[roadstyle logo]

roadstyle

Beautiful, interactive road maps from Python.
One offline HTML file with real road cartography, Google Street View and a JavaScript API.

[PyPI] [Python versions] [Tests] [Docs] [License: MIT]

Install · Quickstart · Gallery · Live map · AI agents · Documentation

[The standard dashboard on a desktop: Monaco on the OpenFreeMap Positron base map, a road selected in the panel at the left, and the toolbox at the right edge] [The dashboard on a phone: the one-row bar at the top, the map, and the panel as a bottom sheet]

[A roadstyle map of Monaco in 3D: bridges, tunnels and roundabouts drawn in order, Rue de la Colle selected, and the floating Street View window showing it]

Why roadstyle

  • Real road cartography. Casing and fill, widths that change with zoom, street names, one-way arrows, tunnels drawn under and bridges over, and optional 3D bridge decks.
  • One offline file. Map, data and styling in a single HTML page: open it without a server, email it, or put it on any website.
  • Street View built in. Click any road to see it in Google Street View, facing the way it runs.
  • Any road data. A GeoDataFrame, a file, DuckDB, Arrow, osmnx or duckOSM.
  • Colour by your data. Speed, traffic or any column, with a legend and a menu of colourings.
  • Scriptable. A window.rs* JavaScript API and events for your own dashboard, and shared parts for its panel: a level editor and a design panel (themes, road colours and widths, names, layers) that any page can open.
  • Ready for AI agents. An MCP server and an agent skill.

What is new in 0.29.0

  • Ask, an AI agent in the side panel: a question in words becomes SQL on the page's data, an answer, a table and roads on the map. It uses the person's own key of a free service (Gemini, Groq, OpenRouter, Z.ai) or of Claude, and Auto goes to the next service or model when one cannot answer (guide).
  • The data dock: a SQL line over a table of the result in the bottom dock; the roads of the result light on the map (guide).
  • Charts and more dashboard parts: rs.chart, the editor frame rs.frame, a colour picker and the parts that duckOSM Studio asked for (guide).
  • The level editor has the tabs Road ends and Stacking, and adds rules from files.

What is new in 0.28.0

  • The design panel is a dashboard part: themes, road colours and widths, names and layers, in any page with a dashboard (guide).
  • 3D buildings: solid by default (a road behind a building does not show through the roof), an Opacity slider and buildings_opacity=, and the far buildings of a tilted map.
  • The open card has an accent ring and an accent title.

What is new in 0.27.0

  • The dashboard's panel starts empty, and a page adds what it needs: its own HTML, the query box or the road card, with dashboard={"panel": {"sections": [...]}} or rs.sections.add. The map of a dashboard has the defaults of a map page. This is a breaking change: see Migrate a dashboard.
  • Cards: one standard for the panel. A section with a label is a card, with or without a background (background: False), that folds or not (fold: True). Every card has the same width, gap, padding and title row, and the "?" of rs.help.button is at the end of the title row.
  • Every part of the dashboard follows the dark theme, and every scroll area scrolls the same way as the panel.
  • Street View: Coverage is an icon after the provider switch, and the close button stays at the top right.

What is new in 0.26.3

  • A dashboard manual. Two pages with maps that run: Dashboards for Python and JavaScript. Each JavaScript example has a Run button.
  • The two directions of a two-way road are two halves of the road at every zoom. A colour on one direction does not hide the other.
  • Fewer arrows on a tiled page, and correct arrows on a page with a vector base map. Monaco, zoom 16.5: 9 arrows, not 85.
  • Street View: the coverage shows on any road, and the header of the window keeps the name of the road. duckosm.page draws the base map's textures and icons, and dashboard=False gives the dashboard without a panel.

What is new in 0.26.1

  • One accent colour. The dashboard uses the Sonocount teal in the light and the dark theme, defined once. The corner box has the shape of the bar, a button with a text shows no tooltip box, and every tool of a phone's one-row bar can be reached.
  • Street View docked, and a dashboard with no panel. street_view="dock" puts Street View beside the map with a divider that you drag. dashboard={"panel": None} gives a map with the toolbox only.
  • Help and folding in the panel. rs.help.button adds a "?" button with its own words to a card or a label, all of them open one window. A Collapse all / Expand all control folds the panel's sections. The level editor has a "?" help window with two links to the levels guide.
  • Fix: a page that starts in the dark theme no longer shows the error "Style is not done loading".

What is new in 0.26.0

  • A standard dashboard and toolbox. rs.render_dashboard(edges) makes a map with one panel and one bar of tools: navigate (zoom, turn and tilt in one box), road filter, base maps, colour and legend, settings and credits. A tool that the page cannot use is grey, and its tooltip says why. The toolbox is at the right edge and the panel at the left. On a phone the bar is one row that you move sideways, and the panel is a bottom sheet.
  • Seven base maps, no key. OpenFreeMap Liberty and Positron (the default), OpenStreetMap, Esri Gray, Esri Streets, Esri Satellite and Blank, each with its dark twin when it has one. The CARTO maps are gone, so no base map needs a key. The theme switch also turns the style's own layers dark.
  • Tiles by default, one rule. Every page keeps its roads as MLT vector tiles to zoom 16, with one road layer for every zoom. The page, the browser worker, export_style and roadstyle tiles all use the same tiling rule. tiles=False gives GeoJSON roads, and tile_format="mvt" gives MVT.
  • The level editor is in the panel. roadstyle levels edit AREA_DIR opens it from the Rust program. It uses the page's standard panel, with an apply bar, red and blue picks, the area boundary (levels make --boundary) and edits.csv in the History tab.
  • Shared dashboard parts. Help window, hover box, tabs, number tiles, tables, charts and chips are in the panel's own look, in both themes. rs.classify makes colour classes for roads.

[The dashboard in the dark theme with the OpenFreeMap Fiord base map: Monaco, one road selected]

More: What is new in 0.28.0 · Dashboard layout · Dashboard parts · Big networks · Move a script from 0.25 · Documentation.

Install

bash
pip install roadstyle              # corepip install "roadstyle[all]"       # + studio, DuckDB, …

Python ≥ 3.10. Individual extras and the dev setup: Install.

Quickstart

From OpenStreetMap, no data needed. Any place, with osmnx (pip install osmnx):

python
import osmnx as oximport roadstyle as rs
G = ox.graph_from_place("Tartu, Estonia", network_type="drive", simplify=False)G = ox.simplify_graph(G, edge_attrs_differ=["bridge", "tunnel"])   # keep tunnels and bridges apartrs.render_edges(ox.graph_to_gdfs(G, nodes=False)).save("tartu.html")

From your own data. Any file or GeoDataFrame with line geometry and a highway column:

python
import geopandas as gpdimport roadstyle as rs
edges = gpd.read_file("edges.gpkg")        # LineStrings + a `highway` column, any CRSrs.render_edges(edges).save("map.html")    # open map.html: no server (Street View needs one)

More looks:

python
rs.render_edges(edges, basemap="ofm_dark", view_3d=True)                # dark, 3D bridge decksrs.render_edges(edges, palette="carto", basemap="ofm_positron")        # the classic OSM lookrs.render_edges(edges, color_by="aadt", cmap="viridis")                # colour by your datars.render_edges(edges, palette="mono", color_options={                 # several colourings,    "Traffic": {"color_by": "aadt", "cmap": "viridis"},                #   switched in the browser    "Speed":   {"color_by": "maxspeed_kmh", "cmap": "magma"}})rs.render_edges(edges, tiles=False)                                    # GeoJSON roads (MLT tiles are the default)rs.render_dashboard(edges).save("dashboard.html")                      # map + panel + the standard toolboxrs.render_street_view(edges).save("street_view.html")                  # map and Street View side by side

No Python? roadstyle edges.gpkg -o map.html --basemap ofm_dark, or click through it in the workbench: pip install "roadstyle[studio]" && roadstyle studio.

Gallery

[The road map look]
The road map look
rs.render_edges(edges)
[Bridges and tunnels]
Bridges and tunnels
rs.render_edges(edges)
[Colour by your data]
Colour by your data
color_by="maxspeed_kmh"
[3D bridges]
3D bridges
view_3d=True
[Street View]
Street View
click a road
[Dashboard]
Dashboard
rs.render_dashboard(edges)

Every look with its code: the gallery.

What goes in

Only geometry and highway are required. Other columns switch features on:

ColumnPowers
geometry (LineString, any CRS)the edges. Each edge is directed: a two-way road is two edges with reversed geometry
highway (OSM class)colour, width, casing, draw order
namestreet labels, popup title
onewaydirection arrows
bridge / tunnel / layergrade separation: tunnels below, bridges on decks above
edge_idpopups; 64-bit ids stay exact
anything elseshown in the popup, queryable from JavaScript

duckOSM (duckosm export-gis) exports exactly this, and osmnx edges work as they are: rs.render_edges(ox.graph_to_gdfs(G, nodes=False)).

Drive it from JavaScript

The saved page exposes window.rs* functions and rs:* events:

js
const ids = rsQuery(p => p.maxspeed_kmh > 30); // feature ids whose properties matchrsColor(ids, "#ff00aa");  rsFocus(ids);       // paint them, fit the cameradocument.addEventListener("rs:select", e => console.log(e.detail.properties));

Every function and event: JavaScript API.

For AI agents

MCP server. Lets any MCP-capable AI app (Claude Code, Claude Desktop, Cursor, …) draw road maps without writing code: render_place("Tartu, Estonia"), render_file("roads.gpkg") and snapshot. Each saves an HTML map and returns its path plus a PNG preview the agent can look at.

bash
claude mcp add roadstyle -- uvx roadstyle-mcp
Claude Desktop, and where the maps go

In claude_desktop_config.json:

json
{"mcpServers": {"roadstyle": {"command": "uvx", "args": ["roadstyle-mcp"]}}}

Maps are saved in ~/roadstyle-maps/. The PNG preview needs Chromium, once: uvx --from roadstyle-mcp playwright install chromium.

Claude Code plugin. The MCP server and the skill below in one install:

text
/plugin marketplace add Khoshkhah/roadstyle/plugin install roadstyle@roadstyle

For agents that write code:

  • skills/roadstyle/SKILL.md: a skill for agents that use roadstyle (the one call, the data contract, the JS API, the traps). Install it for Claude Code:
    bash
    mkdir -p ~/.claude/skills/roadstyle && curl -fsSL -o ~/.claude/skills/roadstyle/SKILL.md \  https://raw.githubusercontent.com/Khoshkhah/roadstyle/main/skills/roadstyle/SKILL.md
  • AGENTS.md: for agents working on this repo.
  • llms.txt: the docs site as a link list for LLMs.

API keys

The key is optional. roadstyle works without it, just with less. The base maps need no key.

  • Google Maps, for Street View. Street View works with no key. A key adds a Linked mode: a real panorama, with the map marker walking and turning with you.
Setting up the Google Maps key

Street View works with no key: the keyless Google embed. With a Google Maps JavaScript API key, the Street View panel and window get a Linked / Classic switch. Linked is a real panorama: the map marker walks and turns with you, and only Google's own street photos are shown. Classic is the keyless embed. To get a key:

  1. In the Google Cloud console, create a project and enable Maps JavaScript API (Google asks for a billing account on the project).
  2. Under APIs & Services > Credentials, create an API key.
  3. Restrict it: Application restrictions = Websites, listing your site's addresses (e.g. https://example.com/*); API restrictions = Maps JavaScript API only.

Then pass it in:

python
rs.render_edges(edges, street_view_key="AIza…")         # the floating Street View windowrs.render_street_view(edges, street_view_key="AIza…")   # the side-by-side page

The key is written into the page, as every browser key is, so the site restriction in step 3 is what protects it. It also means Linked works only on the addresses you listed: to try it on localhost, add http://localhost:*/* to the list. Keep the key out of git, for example in an environment variable.

More: settings & base maps · Google Street View.

Documentation

khoshkhah.github.io/roadstyle, with live maps on every page.

WhereWhat you find
Get startedinstall, a first map, what your data needs
Guidesstyle the roads · colour by your data · your own layers · Google Street View · big networks · dashboards & JavaScript · dashboard layout · dashboard parts · which road is on top · edit the design of a map · on a website
Gallerya picture and one line of code per look
Rust enginethe one engine: the style, the tiles, the levels and the page; the browser package and the crates
Referenceevery parameter · JavaScript API · settings & base maps · command line
Changelogwhat changed in each release

Built on

  • MapLibre GL JS (BSD-3-Clause) draws every web map: roadstyle writes its style and data, and a copy of MapLibre is inlined in each saved page so it opens offline.
  • OpenStreetMap data (© OpenStreetMap contributors, ODbL) and the openstreetmap-carto style, whose road classes, colours and widths roadstyle follows.
  • HiGHS, through SciPy, is the optional Python solver of which road is drawn on top. The default solver is in Rust.
  • GeoPandas and Shapely for the geometry.

License

MIT. Base-map tiles come from third-party services (OpenFreeMap, OSM, Esri) with their own attribution and terms.

來源:README.md,提交 7871c7c

工具

3

render_place

Download the OpenStreetMap road network of a place and draw it as an interactive HTML map. place: any name OpenStreetMap's geocoder knows, e.g. "Södermalm, Stockholm" or "Tartu, Estonia". Keep it to a district or a city: a county takes minutes to download. network_type: "drive", "walk", "bike", "all", "drive_service" or "all_public". options: render_edges keywords, e.g. {"color_by": "maxspeed", "legend": true}. output_path: where to save the .html (default ~/roadstyle-maps/<place>.html). Returns the saved path, a summary and a PNG preview.

輸入參數place必填optionsoutput_pathnetwork_type

render_file

Draw the road edges in a file (GeoPackage, GeoJSON, Shapefile, ...) as an interactive HTML map. The file needs line geometry (any CRS) and a road-class column, "highway" by default (another name: options={"highway_col": "..."}). options: render_edges keywords, e.g. {"color_by": "speed", "cmap": "viridis", "legend": true}. output_path: where to save the .html (default ~/roadstyle-maps/<file name>.html). Returns the saved path, a summary and a PNG preview.

輸入參數path必填optionsoutput_path

snapshot

PNG of a saved roadstyle map, optionally with a camera (centre lon/lat, zoom 0-22). Street names: main roads from zoom 15-16, side streets from 17; one-way arrows: main roads from 15, side streets from 17. Without a camera the map's own opening view is captured.

輸入參數latlonzoompitchbearinghtml_path必填

版本歷史

24
  1. v0.29.0最新Nov 8, 2026
  2. v0.28.0Nov 6, 2026
  3. v0.27.1Nov 5, 2026
  4. v0.27.0Nov 3, 2026
  5. v0.26.3Nov 3, 2026
  6. v0.26.2Oct 31, 2026
  7. v0.26.0Oct 30, 2026
  8. v0.25.0Oct 24, 2026
  9. v0.24.3Oct 22, 2026
  10. v0.24.2Oct 22, 2026
  11. v0.24.0Oct 21, 2026
  12. v0.22.1Oct 18, 2026
  13. v0.21.1Oct 10, 2026
  14. v0.20.0Oct 10, 2026
  15. v0.19.0Oct 8, 2026
  16. v0.17.1Oct 8, 2026
  17. v0.16.0Oct 7, 2026
  18. v0.15.0Oct 4, 2026
  19. v0.13.0Oct 4, 2026
  20. v0.12.0Oct 3, 2026
  21. v0.11.0Oct 1, 2026
  22. v0.9.3Oct 1, 2026
  23. v0.9.2Sep 30, 2026
  24. v0.9.1Sep 29, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分