No description
Find a file
Edward Betts e0ade9e5ab Add web frontend and refactor core to use OsmError
- Refactor core.py: replace sys.exit() calls with OsmError exceptions
  so the library is safe to use from Flask and other callers
- Add fetch_sibling_routes and fetch_route_master_routes to core.py
- Add Flask web frontend (web/app.py, templates, static assets):
  - Map view with Leaflet; full route drawn in grey on load
  - Sidebar stop list; active-slot UX for From/To selection
  - Segment preview and download (full route or selected segment)
  - Include-stops toggle applied client-side
  - Bookmarkable URLs: GET /<relation_id>
  - Clear selection button
  - Other directions panel (sibling routes from same route_master)
  - route_master handling: draws all member routes in colour on map
    with links to each individual direction
- Add SVG favicon
- Add py.typed marker; add .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 18:59:21 +00:00
src/osm_geojson Add web frontend and refactor core to use OsmError 2026-02-27 18:59:21 +00:00
tests Add web frontend and refactor core to use OsmError 2026-02-27 18:59:21 +00:00
web Add web frontend and refactor core to use OsmError 2026-02-27 18:59:21 +00:00
.gitignore Add web frontend and refactor core to use OsmError 2026-02-27 18:59:21 +00:00
AGENTS.md Reorganise 2026-02-27 14:27:38 +00:00
pyproject.toml Reorganise 2026-02-27 14:27:38 +00:00
README.md Reorganise 2026-02-27 14:27:38 +00:00

openstreetmap-tools

A collection of command-line tools for working with OpenStreetMap data.

Tools

osm-pt-geojson

Fetch an OSM public transport route relation and list its stops, or export the route as GeoJSON.

Usage

osm-pt-geojson list-stations <relation_id>
osm-pt-geojson route-between <relation_id> <from_station> <to_station> [-o FILE]
osm-pt-geojson full-route <relation_id> [-o FILE]

List stops on a route:

$ osm-pt-geojson list-stations 18892969
Route: Bus A1: Bristol Airport → Bristol Bus Station
Stops (21):
   1. Airport Terminal
   2. Airport Tavern
   ...
  21. Bus Station

Export a segment between two stops as GeoJSON:

$ osm-pt-geojson route-between 18892969 "Airport Terminal" "East Street" -o segment.geojson

Export the full route as GeoJSON:

$ osm-pt-geojson full-route 18892969 -o route.geojson

Omit stop points from GeoJSON output:

$ osm-pt-geojson full-route 18892969 --no-stops -o route.geojson

GeoJSON is written to stdout if -o is not given.

Output format

A GeoJSON FeatureCollection containing:

  • A LineString feature for the route geometry, with name, ref, from, to, and route properties from the OSM relation tags.
  • A Point feature for each stop, with a name property (omitted with --no-stops).

Installation

pip install osm-geojson

Or from source:

git clone https://git.4angle.com/edward/openstreetmap-tools
cd openstreetmap-tools
pip install -e .

Licence

MIT License. Copyright (c) 2026 Edward Betts.