It’s basically Dijkstra’s Shortest Path on OpenStreetMap data. The web interface allows a user to draw polygons to mark areas where traffic is impossible due to an event.
In a future iteration, these polygons can come from other sources as well.
The routing algorithm will route the shortest path around that area, as you can see in the demo:
Watch this on Vimeo.
To make this a bit more interesting, I wrote a Node.js parser for the ‘NDW databank’ which provides semi-realtime (5 minute updates) traffic information from over 60,000 sensors in the dutch highways and secondary roads. This data is provided in SOAP format, so imagine the hoops I had to jump through to parse this with Node in a fast way. Code is available on request.
A visualisation of a small portion of the NDW data: (the legend is not related to the dots)
The hardest part was developing the 70 line SQL statement to determine the ‘routing cost’ of a route due to current traffic pressure. The SQL is also available for anyone interested.