So, I want to contribute a public transportation route that I know to OSM. It’s a little bit hard, but it’s completely doable by using JOSM. Done.
Next? I want to see all the available bus route that already exist on OSM.
So, I made this : altilunium.github.io/bisangkot
It’s pretty much straightforward. Download the route by using Overpass API, convert the downloaded OSM data into the geojson format, display it by using leaflet, then add a little interactivity control, such as “hover to display the route’s name” and “click to focus the route”.
For this one, I queried the Java island only. You can query other region by using this script. Just change the bbox settings on line 32. Then, convert the downloaded OSM data into the geojson format by using this python script that I made.
The conversion is pretty much straightforward, except this “jitter” function.
You know, a single road may contain several route. This condition could confuse Leaflet js, causing the misfirings of onClick and onMouseover event. So, to fix this problem, I try to separate each route as a single geojson line. Every route that crosses a same road will be moved slightly to random direction and random distance from the original coordinate. This simple trick somewhat solved the problem quite well.
Okary. Now, what next? Maybe, encourage more people to add new public transportation route data, I think. Improve both the data quality and quantity. Or perhaps, let’s make a route finder apps (how to reach point A to point B by using public transportation).
Discussion
Comment from b-unicycling on 4 March 2023 at 17:38
Well done. I agree that the route finder should include public transport.
Comment from MatthiasMatthias on 5 March 2023 at 11:04
I really like the way iD has implemented mapping of public transport. Here is a good tutorial: https://www.youtube.com/watch?v=NPvIGCfrrBo
Comment from b-unicycling on 5 March 2023 at 12:04
Haha, thanks for promoting my video. It’s still a lot of work to map a public transport route, and you easily miss a bit on a bridge or situations like that, where the road bit is very short. I think it’s easier in JOSM to find the gap.