Modify

Opened 10 years ago

Last modified 8 days ago

#9304 new enhancement

in validator, check for intersecting roads in different layers

Reported by: aceman Owned by: team
Priority: normal Milestone:
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 2 weeks ago.
example data
9304.patch (3.2 KB ) - added by GerdP 11 days 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 11 days ago.
improved patch
9304-example-v2.osm (7.6 KB ) - added by GerdP 11 days 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 (24)

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, 2 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, 2 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, 2 years ago

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

Last edited 2 years ago by reichg (previous) (diff)

comment:14 by GerdP, 2 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, 2 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, 2 weeks ago

Attachment: 9304-example.osm added

example data

comment:16 by GerdP, 2 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, 2 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, 11 days 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, 11 days 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, 11 days ago

Attachment: 9304-v2.patch added

improved patch

by GerdP, 11 days 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, 10 days 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, 8 days 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to aceman.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


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