Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start a new transformation that merges a class of parallel cycleways to #61

Merged
merged 1 commit into from
Aug 11, 2022

Conversation

dabreegster
Copy link
Contributor

the main road, preserving lanes. #59

Disabled by default.

I have been puzzling through how to simplify cases like this for a long time, but the last progress was almost two years ago: a-b-street/abstreet#348. I took a fresh approach by

  1. looking for patterns in the graph structure, instead of the previous approach of placing a bunch of perpendicular test lines and seeing what roads are hit
  2. Only attempting cases where the cycleway is completely parallel to main roads. Not yet handling the trickier edge cases where a cycleway is parallel for some percentage of the polyline, but then it curves away.

The result is delightful. Along Roosevelt in Seattle, before:
Screenshot from 2022-08-11 11-23-11
and after:
Screenshot from 2022-08-11 11-23-24
The red lane is the buffer lane inserted. With additional tagging in OSM, we can know if these are flex posts, concrete bollards, a Jersey barrier, striping, etc.

And much more extravagantly, St George's just past the Elephant & Castle roundabout. Before:
Screenshot from 2022-08-11 11-25-42
After:
Screenshot from 2022-08-11 11-26-30

As you can see to the right, the algorithm is far from finished. It gets confused by the "triangular" shape of the cycleway graph there and just leaves it alone. I'm leaving this transformation disabled until more dramatic problems are fixed, like in Taipei... before:
Screenshot from 2022-08-11 11-28-40
Note this paradise of parallel cycletrack is actually mostly-pedestrian space in reality, but that's another issue. After:
Screenshot from 2022-08-11 11-29-20

Clearly something went very wrong. I'll improve the incremental interactive debugging and figure out what. Right now the debugging is shown for all cycleway segments at the same time; we can split this into smaller steps.
Screenshot from 2022-08-11 11-30-47

the main road, preserving lanes. #59

Disabled by default.
// might be more.
let main_road_i1 = main_road_endpoints[0];
let main_road_i2 = main_road_endpoints[1];
// Find all main road segments "parallel to" this cycleway, by pathfinding between
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could perhaps be more paranoid here by checking that the cycleway center line and all of the main road center lines are nice and parallel. If they curve away from each other a bit, then even if the connection roads are under our threshold of 10 meters, we may lose some geometric information by snapping.


streets.debug_road(r, format!("snap_to_left = {snap_to_left}, oriented_same_way = {oriented_same_way}, insert_idx = {insert_idx}"));

// This logic thankfully doesn't depend on driving side at all!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled to write this without scribbling diagrams on paper and using temporary debug visualization. It was a similar experience to sausage links. I hope there will be some better patterns to reason through this kind of thing. Maybe #1 is relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant