1.5 KiB
1.5 KiB
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
LineStringfeature for the route geometry, withname,ref,from,to, androuteproperties from the OSM relation tags. - A
Pointfeature for each stop, with anameproperty (omitted with--no-stops).
Requirements
Install dependencies:
pip install click requests
Licence
MIT License. Copyright (c) 2026 Edward Betts.