a-b-street / osm2streets

Convert OSM to street networks with detailed geometry
https://a-b-street.github.io/osm2streets
Apache License 2.0
94 stars 8 forks source link

Handle the simplest sausage link case #16

Closed dabreegster closed 1 year ago

dabreegster commented 2 years ago

One of my LTN collaborations actually has some pesky geometry issues that look simple to deal with. Screenshot from 2022-05-23 15-49-13 https://www.openstreetmap.org/way/291394487#map=19/51.45946/-2.55068

The dual carriageway exists for a very small space due to a crossing island. In the short term, simplifying this to a regular bidirectional road with nothing special in the middle is appropriate. (I would love to figure out how to properly model crossing islands like this, but that's a later step.)

These look straightforward to detect and transform. I'll only try to handle these loops, where road1 and road2 share both endpoints. This means there can't be any other roads connecting to one side or the other.

CC @martinfleis

dabreegster commented 2 years ago

Part of this will be fixing up the lanes inferred on each piece, because it's definitely wrong right now. It's possible I might block working on this on cutting over to osm2lanes finally, so any fixes can happen in one (better tested) place

BudgieInWA commented 2 years ago

My attempt at something like this in the JOSM Lanes plugin was looking at one merged intersection at a time, but not at any graph properties. I am exploring that idea further, so it would be cool to see any ideas that other people have about it. Looking at the graph might be very powerful, for instances there's a little loop of oneways in the graph for each of the sausages.

It will be interesting for me to see you tackle a transformation in RawMap as a sort of template for how I might do it.

BudgieInWA commented 2 years ago

(I would love to figure out how to properly model crossing islands like this, but that's a later step.)

(I think: the presence of a traffic island implies that a short stretch of the divider has a substantial width. i.e. traffic_calming=island or crossing:island=yes implies a median buffer (which I don't quite know how to tag yet).)

dabreegster commented 2 years ago

It will be interesting for me to see you tackle a transformation in RawMap as a sort of template for how I might do it.

https://github.com/a-b-street/abstreet/blob/5907a8e3035ff7ae4af43568e5ad8d651d2fe400/raw_map/src/transform/find_short_roads.rs#L116 is one half of an example. (The other half is merge_short_road, which doesn't handle all edge cases)

(I think: the presence of a traffic island implies that a short stretch of the divider has a substantial width.

Definitely, and it'll be interesting to see if most roads keep the same overall width and shrink the lanes a bit near the island. There's likely a variety of ways to tag the island; this one example uses an area, https://www.openstreetmap.org/way/496700815, with some footpaths

droogmic commented 2 years ago

A google failed to help me define a sausage link intersection, do we intend to have a glossary in this repo?

dabreegster commented 2 years ago

A google failed to help me define a sausage link intersection, do we intend to have a glossary in this repo?

Yeah, we probably should! I'm not sure where I heard the term first. https://labs.mapbox.com/mapping/mapping-for-navigation/implicit-restrictions/ mentions it. It's when a road constantly transitions between a single and dual carriageway due to some kind of intermittent physical barrier. When rendered in Carto (and osm2streets so far), the road looks kind of like sausage links

dabreegster commented 2 years ago

Need to detect and avoid false positives like:

https://www.openstreetmap.org/node/8141904208#map=19/51.49211/0.00378
https://www.openstreetmap.org/node/9563439140#map=19/51.49990/0.00457
https://www.openstreetmap.org/node/90266738#map=19/51.46112/0.03800
https://www.openstreetmap.org/node/90407230#map=19/51.47857/0.05173
dabreegster commented 2 years ago

Section "Lane markings: Traffic islands require very special treatment" of https://strassenraumkarte.osm-berlin.org/posts/2021-12-31-micromap-update describes a similar process to this transformation

dabreegster commented 1 year ago

I made progress with snippets of contraflow cycleway in the branch above. But I'm hesitant to enable this yet, because I had to shuffle around the order of transformations to make it work. We happen to collapse a short road after doing geometry, and only then do we have the graph structure to spot the sausage link. This is starting to feel precarious -- we could be brute-force and repeat a bunch of transformations until nothing changes anywhere. But is there a more principled and/or performant way of doing it?