adamfranco / curvature

Find roads that are the most curvy or twisty based on Open Street Map (OSM) data.
http://roadcurvature.com/
225 stars 39 forks source link

Avoid looping-back on roundabouts and islands #41

Open adamfranco opened 8 years ago

adamfranco commented 8 years ago

When joining ways for routes that split and then re-join, there are many cases where the joining process will cause the resulting collection to spiral back on itself at a roundabout or divided highway merger rather than continuing along with the main length of highway.

Here are a few examples:

One potential way to fix this is that instead of ordering ways in a route solely by OSM-id before joining, instead the ways could be sorted such that two-way ways come first, followed by normal one-way ways, followed by roundabout ways, *_link ways, and other connectors. Within these groups, ways would be still ordered by OSM-id. This would allow the join process to always try to attach the two-way non-divided highway ways first when encountering a split/merge. Only if no two-way ways can be joined would the join continue on to the other-type ways.

adamfranco commented 4 years ago

Here's another case of staying in a roundabout too long, then making an impossible-to-drive split: Carmel interchange roundabout Curvature_-_Carmel interchange roundabout It looks like this was caused by choosing the roundabout way rather than the entrance way or maybe the join process stepped into the roundabout through the exit way, then continued around the other direction.

One potential option would be to keep track of the direction of one-ways while joining (forward/backward), then not switch one-way directions. This should eliminate at least this particular untravelable case, but wouldn't actually solve the larger loop-back problem noted on US 202.

adamfranco commented 4 years ago

Here's yet another case from Madrid:

Screen Shot 2020-10-26 at 1 38 57 PM

It looks like the splits are being followed in reverse-oneway directions. Maybe when joining and encountering a pair of one_way ways, I walk through them only in that direction and add up the distance traveled, then go back and try the other sequence and keep the one that is longer.

Also this one: https://roadcurvature.com/map/#map=16.469/0.0202/43.2181

Also the Picadilly underpass in London: https://roadcurvature.com/map/?threshold=low#map=17.711/-0.1518/51.504 Screen Shot 2020-11-04 at 1 37 23 PM