Modify

Opened 10 years ago

Closed 3 weeks ago

#9304 closed enhancement (fixed)

in validator, check for intersecting roads in different layers

Reported by: aceman Owned by: team
Priority: normal Milestone: 24.03
Component: Core validator Version: latest
Keywords: layer connected Cc:

Description

I propose to add new test into the validator that would emit a warning for this situation:

  • Intersecting roads (sharing a node) if their layer= value is different.
  • Road ending on another road (sharing a node but terminating there) if their layer= value is different AND if their highway= value is different. This should filter out legitimate cases of bridges (part of the same road is without layer, the part on the bridge is layer>0 and they must meet somewhere).

Maybe the check can be done on other type of objects but I am not sure if that is safe. But in case of roads incorrect intersection nodes cause wrong routing on nodes where it is not possible in reality.

Attachments (4)

9304-example.osm (3.7 KB ) - added by GerdP 8 weeks ago.
example data
9304.patch (3.2 KB ) - added by GerdP 7 weeks ago.
first implementation which checks only highways and ignores ways with highway=steps, creates a warning for the connection node with the text tr("Node connects highways on different layers")
9304-v2.patch (3.1 KB ) - added by GerdP 7 weeks ago.
improved patch
9304-example-v2.osm (7.6 KB ) - added by GerdP 7 weeks ago.
more test cases, with 9304-v2.patch the nodes with tag josm_error_codes=2708 are flagged

Download all attachments as: .zip

Change History (40)

comment:1 by mkoniecz, 10 years ago

It should work also for footways, paths, cycleways, bridleways, railways and waterways.

Maybe for power lines - if tagging scheme used there is sane.

comment:2 by aceman, 10 years ago

I'd say power lines could be a different beast, they may share a power tower in the same level (because there are several cables), can share a way and then separate starting at some power tower. They could be mapped using overlapping and crossing ways. And if we wanted to still use layer on them, it may be hard to choose a proper values as power lines do not really change properties in their run, so can be mapped using a country long way. Having a single layer>=1 for the whole run may be insufficient for them.

OK, back to the topic. The second restriction may not be correct. A bridge (layer=1) may be connected to several roads at one side (think motorway + motorway_link) so the check as described does not work (even though the wiki discourages such a junction, but the example is not really a junction). So maybe the check should be reduced to test T- and +-shaped junctions where a road connects in the middle of another one with a different layer.

comment:3 by mkoniecz, 10 years ago

"even though the wiki discourages such a junction" - and there is a good reason for this, so detecting things like this is not a bad idea. There is small risk that situation where this is a proper mapping are more popular than some may expect. But separate test may be a better idea here (node with more that free ways carrying the same type of traffic*, bridge/tunnel status is not the same?).

*road/footway/cycleway/railway/waterway

in reply to:  3 comment:4 by aceman, 10 years ago

Replying to Bulwersator:

"even though the wiki discourages such a junction" - and there is a good reason for this, so detecting things like this is not a bad idea. There is small risk that situation where this is a proper mapping are more popular than some may expect.

Yes I have no problem if you warn of this usage too. I leave the decision to more knowledgeable mappers/developers.

But separate test may be a better idea here (node with more that free ways carrying the same type of traffic*, bridge/tunnel status is not the same?).

I am not sure what you ask about bridge and tunnel...

comment:5 by RicoZ, 8 years ago

there are two slightly different situations:

Different layers but one of them is implicit layer=0. I think there is little that can be done in this case as an implicit layer is a bit like a joker and I would expect many false positives. Maybe later but would certainly exclude this case in the beginning.

Two explicitly different layers - there may be some useful tests that can be done here:

  • any way with an explicit layer should have a bridge/tunnel or one of the other tags mentioned in key:layer. I frequently search for "stale layer" tags with "(highway | railway=rail |waterway) -layer=0 layer=* -tunnel=* -bridge=* -culvert=yes -*=steps -*=elevator -covered=yes -indoor=yes" and it finds me plenty of mapping errors like missing bridges etc with not too many false positives
  • when two bridges cross with a shared node other than a pylon/lift it can be considered an unintended mistake with high probability, the confidence decreases with longer bridges so maybe there should be a cutoff like 3 or 4 nodes maximum bridge length for this check in the beginning

in reply to:  5 comment:6 by ssprunk, 7 years ago

Replying to RicoZ:

  • when two bridges cross with a shared node other than a pylon/lift it can be considered an unintended mistake with high probability, the confidence decreases with longer bridges so maybe there should be a cutoff like 3 or 4 nodes maximum bridge length for this check in the beginning

I've never seen a case where this was a mistake, and it's fairly common to have T (two ways) or Y (three ways) junctions of bridges, the latter particularly with freeway ramps. I'll grant that + (two, three or four ways) junctions are rare, in part because they are so difficult to construct, but enough of them exist that false positives would seem to outweigh true positives.

A Y or | junction with bridge and non-bridge is probably correct, but a T junction probably isn't--and I know Mapnik doesn't render them well even when correct. I'm not sure layer actually matters, aside from bridges implying layers.

comment:7 by skyper, 3 years ago

If I got it right, a warning about every junction of linear high/rail/waterway with different layer=* on the two (T- or X-junction) or more ways sharing the node should raise a warning, right.

Another question are the stale layer tags which is partially implemented (waterway) and discussed in several other tickets like #9819.

comment:8 by skyper, 3 years ago

See also #18202.

comment:9 by skyper, 3 years ago

Keywords: layer connected added

in reply to:  7 comment:10 by reichg, 3 years ago

Replying to skyper:

If I got it right, a warning about every junction of linear high/rail/waterway with different layer=* on the two (T- or X-junction) or more ways sharing the node should raise a warning, right.

Another question are the stale layer tags which is partially implemented (waterway) and discussed in several other tickets like #9819.

Is this the solution? I can start working on it if it is!

comment:11 by GerdP, 3 years ago

What's wrong with two highways that share a node but have different layer=* values? I can't think of any reason for a warning.

comment:12 by skyper, 3 years ago

We should collect some example in a file. One of the most simple cases is a X-crossing of two high-/rail-/waterway with different layer=* which looks odd in my eyes (#18202).

comment:13 by reichg, 3 years ago

For routing purposes this example would this route a driver to turn onto/into the tunnel?

Version 0, edited 3 years ago by reichg (next)

comment:14 by GerdP, 3 years ago

In the example the tunnel is not connected to the motorway, so no. I assume the example is wrong and was meant to have a connection. In that case I do indeed miss a warning as a motorway should not have crossings.

in reply to:  7 comment:15 by aceman, 8 weeks ago

Replying to skyper:

If I got it right, a warning about every junction of linear high/rail/waterway with different layer=* on the two (T- or X-junction) or more ways sharing the node should raise a warning, right.

Another question are the stale layer tags which is partially implemented (waterway) and discussed in several other tickets like #9819.

For me, this is what I meant.
It should warn if a road going under a bridge (layer 0) is needlessly connected by a node to a bridge crossing overhead (layer=1) that road.

There may be some cases when this is correct, like when different roads have different layers but none of them is a bridge, they just have different layers due to passing over some objects elsewhere, not at the junction. But layer should not be applied to long segments of roads needlessly (it is explicitly cited on the wiki) so this may not be a problem (or actually uncovers this abuse of layer tag).

This check must explicitly ignore objects that have different layers but intersect without having a common node. That seems to be what layer is actually used for.

by GerdP, 8 weeks ago

Attachment: 9304-example.osm added

example data

comment:16 by GerdP, 8 weeks ago

I've collected some rather simple cases. I think we agree that the two nodes which connect the secondary with the unclassified road should produce a warning. I think the steps should not. What about the road that is connected near the end of the brige?
What if the secondary road would be split at the node which is connected to the unclassified. We still want the warning, right?
What if the tunnel=yes or bridge=yes is removed?

comment:17 by skyper, 8 weeks ago

In my eyes, all are problems and could be mapped better.

  • a way does usually not start/end at the tunnel entrance
  • a way splitting on a bridge (or inside a tunnel) usually has a short part also a bridge/tunnel which should be clear if you add the corresponding man_made as area.
  • a step usually does not split at the middle of a highway. I tend to a footway/path as connection.

by GerdP, 7 weeks ago

Attachment: 9304.patch added

first implementation which checks only highways and ignores ways with highway=steps, creates a warning for the connection node with the text tr("Node connects highways on different layers")

comment:18 by GerdP, 7 weeks ago

Feel free to suggest a better wording, I'd prefer intersecting roads in different layers but the test only marks the node, not the connected ways.
Note that the test doesn't calculate the angles between ways, it just counts neighbouring nodes on the same layer.

"Road ending on another road (sharing a node but terminating there) if their layer= value is different AND if their highway= value is different."

I didn't understand that. Now I noticed that the code doesn't catch the a bride and another way build a T-crossing with the bride building the horizontal part.
Work in progress...

by GerdP, 7 weeks ago

Attachment: 9304-v2.patch added

improved patch

by GerdP, 7 weeks ago

Attachment: 9304-example-v2.osm added

more test cases, with 9304-v2.patch the nodes with tag josm_error_codes=2708 are flagged

comment:19 by GerdP, 7 weeks ago

I am not sure what to do with nodes where two or more different layers are connected and none is layer=0. For the "normal" cases it seems to work fine.

comment:20 by GerdP, 6 weeks ago

Just to mention: Up to now I've not found such a problem in real data, so it doesn't seem to happen often.

comment:21 by GerdP, 3 weeks ago

Since nobody mentioned a real world example I wonder if I should add the test or not.
In the German forum a different (but real world) case regarding man_made=bridge was mentioned:
https://community.openstreetmap.org/t/bruckenproblem-oder-doch-nicht/111282
The patch would not help here.

in reply to:  19 comment:22 by skyper, 3 weeks ago

Replying to GerdP:

I am not sure what to do with nodes where two or more different layers are connected and none is layer=0.

I took a quick look at bridges with multiple decks and here you go (George Washington Bridge, NY):
osmwww:way/1026371206
osmwww:way/46590477
osmwww:node/298792359
It is layer=-1 to layer=1.

Guess this highway should not be connected with the bridge outline and be reported, similar to the German example:
osmwww:way/849939329
osmwww:way/392759062
osmwww:node/3959468913

comment:23 by GerdP, 3 weeks ago

I've downloaded the area around George Washington Bridge. Good example. The test complains about these nodes:
https://www.osm.org/node/11170628882
https://www.osm.org/node/9563821066
https://www.osm.org/node/10873903276
https://www.osm.org/node/10658481119
https://www.osm.org/node/11595081902

I don't see yet a problem with the node 298792359. It's unusual to connect layer -1 with layer 1 but not wrong?
I also don't think that node 3959468913 is a mapping error, but it shows how complex it will be to avoid false positives.

Last edited 3 weeks ago by GerdP (previous) (diff)

in reply to:  23 comment:24 by skyper, 3 weeks ago

Replying to GerdP:

I've downloaded the area around George Washington Bridge. Good example. The test complains about these nodes:
https://www.osm.org/node/11170628882
https://www.osm.org/node/9563821066
https://www.osm.org/node/10873903276
https://www.osm.org/node/10658481119
https://www.osm.org/node/11595081902

In my eyes, all mapping errors and the warning is correct.

I don't see yet a problem with the node 298792359. It's unusual to connect layer -1 with layer 1 but not wrong?

Yes, just an example with different layer values on both sides, nothing wrong. I thought you are looking for this uncommon case.
Somewhere deep in my brain, I remember intersections on bridges with three connected ways with one node in common and different layer values (maybe Queensboro Bridge, NY, or Williamsburg Bridge, NY) but I do not find it right now or it was changed over the years.

comment:25 by GerdP, 3 weeks ago

OK, I think I'll work on a unit test next. Maybe a similar test can be done for man_made=bridge, but I fear it is much more likely to produce false positives.

comment:26 by skyper, 3 weeks ago

Well, highways should only start or end at the node sharing with the man_made=bridge and the highway on the bridge (inside the area) should have the same layer value. Though this is the next step and I'd be happy if we first find all problems with only highways.

Edit: See #23601.

Last edited 3 weeks ago by skyper (previous) (diff)

comment:27 by GerdP, 3 weeks ago

Resolution: fixed
Status: newclosed

In 19029/josm:

fix #9304: in validator, check for intersecting roads in different layers

  • initial implementation of the test
  • functional test with examples, also checks code coverage

comment:28 by GerdP, 3 weeks ago

Milestone: 24.03

comment:29 by skyper, 3 weeks ago

Nice, I just found a wrong layer=-1 on a highway=pedestrian area.

comment:30 by GerdP, 3 weeks ago

Oh, I didn't even think about areas. Can you give an example?

comment:32 by GerdP, 3 weeks ago

Resolution: fixed
Status: closedreopened

Hm, I think the warning is a false positive. I should probably exclude areas from this test.

comment:33 by skyper, 3 weeks ago

Well, it was OK in my case but overall this can lead to false positives without enough information to get it correct. Therefore, yes, you might want to exclude areas.

comment:34 by GerdP, 3 weeks ago

It was not OK in your case unless you think that pedestrian areas should never have layer=-1. But that's a different idea.

comment:35 by skyper, 3 weeks ago

I see, it was a false positive but I discovered an error. It looked like someone silenced a validating report of overlapping areas (pedestrian and building).
Pedestrian areas with layer=-1 is a rare case, I guess, and I would expect at least covered=yes or tunnel=yes. In most cases the other involved objects above the pedestrian areas should get a positive layer value but that is a different story.

comment:36 by GerdP, 3 weeks ago

Resolution: fixed
Status: reopenedclosed

In 19034/josm:

fix #9304: fix #9304: in validator, check for intersecting roads in different layers

  • exclude highway areas with layer != 0 from test
  • add one more test case with a bridge that is split (code coverage)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.