I’ve built a small web tool for generating GeoJSON from OpenStreetMap public transport route relations and wanted to share it here in case it’s useful.
https://openstreetmap.tools/public_transport_geojson/
You paste in a relation ID or an OSM URL and it fetches the route and displays it on a map. From there you can select a start and end stop (by clicking the map or the stop list) to extract a segment. If you don’t want stop points to be included in the generated GeoJSON you can turn them off. There is the option to download either the selected segment or the full route as a GeoJSON file.
It supports bus, tram, subway, train, light rail, trolleybus, monorail, ferry and funicular routes. If you enter a route_master relation it shows all directions on the map, with links to each individual route relation.
There is also a JSON API if you want to fetch route data programmatically.
Example: Bus A1: Bristol Airport → Bristol Bus Station
At the moment there is no built-in search: you need to find the relation ID or URL elsewhere (for example on the OSM website or via Overpass) and paste it into the tool.
The source code is here (MIT licence):
https://git.4angle.com/edward/openstreetmap-tools
It uses the standard OSM API and does not require authentication.l
I’d welcome any feedback, particularly if you find routes that do not render correctly or if there are PTv2 tagging patterns it is not handling well.
