-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WIP, got things glued together, but the algorithm itself is very wrong
…refs too early, before we commit
eh, it finds a cycle, but has to backtrack and so includes too much stuff
dabreegster
force-pushed
the
cycle_finder
branch
from
March 29, 2024 10:47
aa0cf53
to
398a5ec
Compare
…ction This doesn't seem to do the right thing all the time though
Despite some weirdness with the left/right, it does appear to get everything!
CC @andrewphilipsmith and @sgreenbury as FYI; this was the idea I described earlier this week |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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:
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:
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.