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

Interpreting negative space #250

Merged
merged 15 commits into from
Mar 29, 2024
Merged

Interpreting negative space #250

merged 15 commits into from
Mar 29, 2024

Conversation

dabreegster
Copy link
Contributor

A first step towards #248. Not ready to merge yet, but I wanted to open for feedback on how to use this.

This PR introduces a way to start at a road or intersection, then find a small cycle starting and ending on it, and generate the polygon that (approximately) fills the negative space between everything. Based on the types of roads and intersections in that cycle, the "block" gets classified as a few different cases.

image
The green polygon represents the area between a road and a separately mapped sidewalk. Assuming the road width and sidewalk placement is roughly accurate, then this could have a few interpretations. Sometimes it's a wide pavement, or the planter strip (or "verge"?) often found in suburbia:
image

image
The purple polygon is the space between dual carriageways. In OSM, a road is split into a dual carriageway when there's some kind of phyical separation between the two sides, not just paint. We could try and render something here, maybe.

There are more cases I'll add, like the space between a cycleway and road (hopefully some kind of separation for the cycleway) or the space between cycleway and sidewalk (maybe separation, or maybe just a little curb).

For this first step, I think I just want to settle for finding the polygons, classifying them, and rendering in an off-by-default layer for debugging. I'll first work on finding all of the blocks (problems handling both sides of a road and dealing with dead-ends) and improving the classification.

But more ideas in #248 could come later. We could also change the block-tracing logic to only follow sidewalks and crossings, and wind up with a nice big junction shape around all of something like this:
image
In that case, the big polygon is probably less useful. Seeing all of the Intersections and Roads inside is useful, because then we can reason about vehicle stop lines (behind the crosswalks, probably) and generate high-level movements through the whole junction.

Or similarly, we could try to group all of the parallel-ish OSM ways and have a higher-level representation of all of the street features from right-to-left, no matter how they're split up in OSM. Answering if https://www.openstreetmap.org/way/422264711 has a sidewalk is not straightforward, but with this kind of grouping, it would work.

@dabreegster
Copy link
Contributor Author

Alright, I got the block-finder to pretty much handle everything except dead-ends / edge of the map. Added a few more categories in the classification, but each of them still needs some work. And improved the debugging UI a bit. Going to merge and take smaller steps.

image
image

@dabreegster
Copy link
Contributor Author

CC @andrewphilipsmith and @sgreenbury as FYI; this was the idea I described earlier this week

@dabreegster dabreegster merged commit 5b53137 into main Mar 29, 2024
@dabreegster dabreegster deleted the cycle_finder branch March 29, 2024 11:56
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.

1 participant