Filters for roads which can be cycled. Aware of one-way roads, and assumes that cyclists care about them
Routed using A*, for least distance
300 lines of python, including outputs to image and OSM file
3.2 seconds on 800MHz PC to parse london.osm (800KB), do the routing, and generate the image
The picture
Starting at the junction of Charlotte street and Tottenham street in London
White is the start point. Yellow is the end point
Grey lines are routes that were considered.Blue dots are nodes that were considered.
Green dots are nodes that were still in the queue for testing when the solution was found (note: A* guarantees that the route found is better than any possible route from these green dots)
Green line and light-green nodes indicate the final route
We've had to allow primary roads to be used, because otherwise you
can't get across the river at all.
But here, it's actually following a big road for lots of the
journey, illustrating why it needs weightings to be applied to the different
sort of route rather than just 'usable/unusable'
More benchmarks, more uses
karouf reports that it took 1min11 to route over 100km using a 146MB osm file