I've started https://github.com/dabreegster/osm2svelte/blob/main/src/lib/modes/RouteProfileMode.svelte in an existing project to explore routing cost functions. (As soon as the Github outage is over, there'll be a deployed link to play with.) You can import any area from Overpass using osm2streets. Then per road segment (edge in the graph), the raw OSM tags (including highway) and processed lane list are available. Those're fed into a calculateWeight function, which returns a rating in [0.0, 1.0]. (Right now it just does something trivial as an example)
The intention is to use this to interactively explore different routing cost functions. Some ideas for next steps (perfectly sized for a one-day hackathon!!):
[ ] Improve the heatmap / visualization of the cost
[ ] Implement some different cost functions (from A/B Street, the tag-based linear regression in this repo, attempt to port the routing profiles from common OSS routers, etc)
[ ] Wire up a Svelte UI to change cost function
[ ] (For my own interests: prioritize small wiggly alleyways or streets with many nearby amenities, for exploratory walks)
[ ] Add a simple A -> B router to this, using the specified cost function
[ ] Explore non-scalar cost functions. Normally Dijkstra would sum up distance * (1 + cost) (with lower cost being a better choice). We could also try avoiding the worst case cost, even if the distance is small, by using Cartesian ordering of tuples in the priority queue.
[ ] Have a UI to calculate multiple A->B paths, to compare different cost functions
[ ] Plug in some OD data (bunch of A->B pairs), calculate all the routes according to a cost function, and display the route network
I've started https://github.com/dabreegster/osm2svelte/blob/main/src/lib/modes/RouteProfileMode.svelte in an existing project to explore routing cost functions. (As soon as the Github outage is over, there'll be a deployed link to play with.) You can import any area from Overpass using osm2streets. Then per road segment (edge in the graph), the raw OSM tags (including
highway
) and processed lane list are available. Those're fed into acalculateWeight
function, which returns a rating in [0.0, 1.0]. (Right now it just does something trivial as an example)The intention is to use this to interactively explore different routing cost functions. Some ideas for next steps (perfectly sized for a one-day hackathon!!):
distance * (1 + cost)
(with lower cost being a better choice). We could also try avoiding the worst case cost, even if the distance is small, by using Cartesian ordering of tuples in the priority queue.This is effectively a web-based revival of a very old idea, https://github.com/a-b-street/abstreet/issues/237