opentripplanner / OSMSplit

Splits OSM ways to create a routable network
22 stars 5 forks source link

Trouble re-matching conflated streets with segments... new conflation rule? #6

Closed pdxmele closed 12 years ago

pdxmele commented 12 years ago

I'm having some trouble re-matching a few street segments with conflated streets properly in PostGIS (93 out of 200,000+) at last attempt. The problem seems to occur when a conflated street overlaps itself, as with 30815 in the linked doc, originally made up of 4 segments: https://docs.google.com/document/d/1HryndSQ4EPo4lQNsOVhpm8rLi__Wq_kC-LclUzOEZcI/edit

So, I was thinking we might be able to fix the problem by instituting a rule for conflated streets--- that they can't cross themselves? Any time it would, it should begin a new segment instead. Loops would be okay (it can touch the other end, but can't extend past that point).

Does that sound reasonable to implement? Other suggestions are welcome as well. Thanks!

novalis commented 12 years ago

I'm not sure I understand exactly what the rematching process is, and how it's broken. Can you explain? Do you mean that osmsplit is giving bad results, or that other code that interacts with the database just doesn't like self-intersecting streets?

I might be able to split off self-intersecting streets, but I'm not 100% sure.

pdxmele commented 12 years ago

The other code that interacts with the database (though it's just a spatial join via ST_Contains in PostGIS) doesn't like to match street segments with the conflated streets that they belong to---if those conflated streets are self-intersecting. All of the other segments can find which conflated street they belong to just fine.

novalis commented 12 years ago

Implementing this is more complicated than expected. I have on more question: does "self-intersection" refer only to crossings -- that is, places where 4 edges meet at a node? Or does it also also refer to mid-street loops like http://www.openstreetmap.org/?lat=45.522871&lon=-122.623027&zoom=18&layers=M

pdxmele commented 12 years ago

Mid-street loops did not cause a problem. Primarily, the problem is when the conflated street crosses over/under itself but does not actually meet itself, as is the case with a loop that has a separate segment in OSM as a bridge or a tunnel (example at Rocky Butte: http://www.openstreetmap.org/?lat=45.545595&lon=-122.567938&zoom=18&layers=M). I'll try to get some more examples together for you later this afternoon.

pdxmele commented 12 years ago

Yeah, actually even lollipops seem fine, so that leads me to believe that the problem only exists when a conflated street crosses above/below another part of itself without actually being connected by a node at that point. So, the problem only seems to occur when it is not connected to itself by a node but crosses itself nonetheless.

If troubleshooting this turns out to be very hard, perhaps we can conflate only when the "layer" tag is the same as well (with the absence of a "layer" tag being equivalent to "layer = 0")... though this would create some unnecessary splits at bridges/tunnels (which I'm pretty sure would be fine).

Other examples--- this happens quite a lot at freeway onramps and offramps (since they're all unnamed and cross above and below each other freely):

http://www.openstreetmap.org/?lat=45.555648&lon=-122.677833&zoom=18&layers=M http://www.openstreetmap.org/?lat=45.62352&lon=-122.67018&zoom=17&layers=M http://www.openstreetmap.org/?lat=45.530194&lon=-122.565381&zoom=18&layers=M

novalis commented 12 years ago

Fixed, I think.

pdxmele commented 12 years ago

Great work! Looks like all of them are working now except for two areas (four segments) where I can't figure out what the problem is... and I think they're tagged properly.

The first is (same as earlier) at Rocky Butte where there's a tunnel that goes below another part of the same (named) street that is remaining conflated throughout --- http://osm.org/go/WIDyPk_AD-- . That middle segment has a tunnel = yes and layer = -1, and the ways that won't match are 30216982 and 5534065.

The second is down in West Linn, which looks just like every other freeway onramp/offramp that crosses itself. The segment that crosses above has a layer = 1 and bridge = yes tags. It involves ways 120727562 and 5277822. http://osm.org/go/WIDguopKu--?way=120727562

Any ideas? It would be great to get them all working (but if we can't, only four errors out of 200,900+ segments is still undeniably excellent)!

pdxmele commented 12 years ago

The fix worked great, thanks again!