Modify

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#20742 closed enhancement (fixed)

[PATCH] No warning about barrier with inappropriate access tags on highway

Reported by: skyper Owned by: team
Priority: normal Milestone: 21.10
Component: Core validator Version:
Keywords: template_report highway barrier access Cc:

Description

What steps will reproduce the problem?

  1. Download a motorway way
  2. Add a node with barrier=gate
  3. Run validator

What is the expected result?

Some kind of warning

What happens instead?

No warning

Please provide any additional information below. Attach a screenshot if possible.

The example is on one edge of the spectrum of tags. Some barriers might be ok for some kind of highways.
Usually, I would expect barriers only on minor roads at least below tertiary but maybe even below residential and unclassified.
But in reality we find barriers on national borders and toll infrastructure, too.

So the access values need to be taken into account.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-04-09 23:18:01 +0200 (Fri, 09 Apr 2021)
Revision:17736
Build-Date:2021-04-10 01:30:58
URL:https://josm.openstreetmap.de/svn/trunk

Attachments (12)

20742_examples.osm (5.4 KB ) - added by skyper 3 years ago.
some simple examples
20742_v1.patch (995 bytes ) - added by reichg 3 years ago.
added requirement that node must be connected to parent way WITH highway tag.
20742_v2.patch (1.3 KB ) - added by reichg 3 years ago.
restricts barrier test to major_roads (teriary_link and above).
20742_v3.patch (1.1 KB ) - added by reichg 3 years ago.
moved major highways into the test as a long regex entry.
20742_v4.patch (1.1 KB ) - added by reichg 3 years ago.
added [!vehicle] to node
20742_v5.patch (1.1 KB ) - added by reichg 3 years ago.
adjusted warning
20742_v6.patch (1.1 KB ) - added by reichg 3 years ago.
added barrier!~/border_control|height_restrictor|toll_booth/
20742_v7.patch (1017 bytes ) - added by reichg 3 years ago.
suspicious barrier and removed asserts.
20742_v8.patch (2.0 KB ) - added by reichg 3 years ago.
including lower class roads that famlam introduced
20742_v9.patch (2.0 KB ) - added by reichg 3 years ago.
Everything except the usage of parent tags. Not sure how to get the proper parent tag if there are multiple parents.
20742_v10.patch (2.1 KB ) - added by Famlam 3 years ago.
With group on the second part of the patch & indentation made consistent :)
20742_v11.patch (2.1 KB ) - added by reichg 3 years ago.
indentation fix

Download all attachments as: .zip

Change History (63)

comment:1 by reichg, 3 years ago

Can we start a discussion on this? This sounds like it could be pretty complicated with specific requirements.

comment:2 by reichg, 3 years ago

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

comment:3 by reichg, 3 years ago

Not exactly sure what needs to be done here still. Would like a discussion about potential modifications.

comment:4 by skyper, 3 years ago

Summary: No warning about barrier with inproper access tags on highwayNo warning about barrier with inappropriate access tags on highway

comment:5 by reichg, 3 years ago

Still need a discussion on this to determine what changes need to be made.

comment:6 by reichg, 3 years ago

Not sure how we can proceed with this if there aren't concrete requirements for this warning.

Are you proposing that on a highway above Tertiary, if barrier=* is present then there also needs an access=* tag accompanying it?

comment:7 by skyper, 3 years ago

I see two major scenarios here:

  • a barrier on a way's middle node where the access tags conflict
  • barrier on shared ways' end nodes

Conflicts are not value conflicts but rather the opposite and the access tags on the highway can be stricter than on the barrier but not upside down.

As end nodes are tricky, let's focus on middle nodes. With any highway for motorcars I would expect some access tag on the barrier or the access has to be denied on the highway. I'll see, if I can make up some examples.

I don't expect this test to dip that deep into the matter but finding the easily recognizable main problems could help. The rest is better integrated in #18364.

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

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

Replying to skyper:

I see two major scenarios here:

  • a barrier on a way's middle node where the access tags conflict
  • barrier on shared ways' end nodes

Conflicts are not value conflicts but rather the opposite and the access tags on the highway can be stricter than on the barrier but not upside down.

As end nodes are tricky, let's focus on middle nodes. With any highway for motorcars I would expect some access tag on the barrier or the access has to be denied on the highway. I'll see, if I can make up some examples.

I don't expect this test to dip that deep into the matter but finding the easily recognizable main problems could help. The rest is better integrated in #18364.

Yes, some examples would be good. I am not sure I am understanding the conflict part between access and barrier.

by skyper, 3 years ago

Attachment: 20742_examples.osm added

some simple examples

comment:9 by skyper, 3 years ago

Ok, I've attached some examples:

  • A1 is the simplest case with missing access tag on barrier or highway
  • A2 is ok regarding motor_vehicle
  • A3 and A4 are ok

Now some examples with end nodes.

  • B1 looks suspicious
  • B2-B4 are rather ok

What should be warned about are barriers on intersections which is usually wrong, see C.

Hope this helps a bit.

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

comment:10 by reichg, 3 years ago

very basic patch 20742_v1 here creating the "suspicious barrier tags" test group. Checks for some basic combinations regarding barrier tag.

The intersection logic might need to be added in java. How can this patch be improved?

comment:11 by reichg, 3 years ago

Summary: No warning about barrier with inappropriate access tags on highway[PATCH] No warning about barrier with inappropriate access tags on highway

by reichg, 3 years ago

Attachment: 20742_v1.patch added

added requirement that node must be connected to parent way WITH highway tag.

comment:12 by Famlam, 3 years ago

This would also trigger on i.e. a bollard on a cycleway, or a cycle barrier on a footway, which doesn't require more tags. I think you must make explicit to only involve major ways (tertiary and above). (For lower car-roads, i.e. residential, it's not uncommon that it contains a bollard midway to prevent traffic from using it as a shortcut; at least in NL)

comment:13 by reichg, 3 years ago

Are there any other combinations to look out for that I should ignore? Easy fix.

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

by reichg, 3 years ago

Attachment: 20742_v2.patch added

restricts barrier test to major_roads (teriary_link and above).

comment:14 by reichg, 3 years ago

@Skyper, how detailed do you want this barrier test to be? Keep it at tertiary and above or look into residential/unclassified as well?

in reply to:  14 comment:15 by reichg, 3 years ago

Replying to reichg:

@Skyper, how detailed do you want this barrier test to be? Keep it at tertiary and above or look into residential/unclassified as well?

Also, can someone explain why patch 20742_v2 does not work when I set major_roads as tertiary and above tags and refer to it in the test? Looks like everything should work? It works as intended when I move the regex highway=~/^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link)$/ into the test without the reference.

Version 2, edited 3 years ago by reichg (previous) (next) (diff)

by reichg, 3 years ago

Attachment: 20742_v3.patch added

moved major highways into the test as a long regex entry.

comment:16 by reichg, 3 years ago

patch 20742_v2 does not work with separate regex variable. but patch 20742_v3 works with regex entry hard coded without a variable. Little confused.

in reply to:  14 comment:17 by skyper, 3 years ago

Replying to reichg:

@Skyper, how detailed do you want this barrier test to be? Keep it at tertiary and above or look into residential/unclassified as well?

Keep it simply, for now, and let us start with tertiary and above, only.

Replying to reichg:

patch 20742_v2 does not work with separate regex variable. but patch 20742_v3 works with regex entry hard coded without a variable. Little confused.

Think I had similar problems working with the external rules PublicTransportGtfs and did not understand it either. Maybe it does not work on the left side? Bug?

comment:18 by Famlam, 3 years ago

You've discovered #10215 ;)

I would also add [!vehicle] to the node check, to catch (on major highways probably rare) cases where i.e. most vehicles are not permitted, but certain and i.e. foot are. Such a case would be i.e. a busway that transfers into a tertiary

Last edited 3 years ago by Famlam (previous) (diff)

by reichg, 3 years ago

Attachment: 20742_v4.patch added

added [!vehicle] to node

comment:19 by anonymous, 3 years ago

May I propose to also change
throwWarning: tr("{0} tag on node missing complimentary tags such as {1}, {2}, or {3}.", "barrier", "access", "motor_vehicle", "vehicle");
to
throwWarning: tr("{0} without access tags such as {1}, {2}, or {3}.", "{0.tag}", "access", "motor_vehicle", "vehicle");

I.e., a 'bad' bollard would yield:
barrier=bollard without access tags such as access, motor_vehicle, or vehicle.

comment:20 by Famlam, 3 years ago

And also to be excluded:
barrier=border_control|height_restrictor|toll_booth

by reichg, 3 years ago

Attachment: 20742_v5.patch added

adjusted warning

comment:21 by reichg, 3 years ago

whoops need to address last comment

by reichg, 3 years ago

Attachment: 20742_v6.patch added

added barrier!~/border_control|height_restrictor|toll_booth/

comment:22 by Famlam, 3 years ago

May I propose to combine
[barrier!=entrance][barrier!~/border_control|height_restrictor|toll_booth/]
to
[barrier!~/entrance|border_control|height_restrictor|toll_booth/]?
(or [barrier!~/^(entrance|border_control|height_restrictor|toll_booth)$/])

in reply to:  19 comment:23 by skyper, 3 years ago

Replying to anonymous:

May I propose to also change
throwWarning: tr("{0} tag on node missing complimentary tags such as {1}, {2}, or {3}.", "barrier", "access", "motor_vehicle", "vehicle");
to
throwWarning: tr("{0} without access tags such as {1}, {2}, or {3}.", "{0.tag}", "access", "motor_vehicle", "vehicle");

Even following might work:

throwWarning: tr("{0} without {1} tags such as {1}, {2}, or {3}", "{0.tag}", "{1.key}", "{2.key}", "{3.key}");

I.e., a 'bad' bollard would yield:
barrier=bollard without access tags such as access, motor_vehicle, or vehicle.

But, wait a minute. This rule is more about a suspicious barrier or access tags missing on either the barrier or the highway:

throwWarning: tr("Suspicious {0} on {1} without {2} tags such as {2}, {3}, or {4}", "{0.tag}", "highway", "{1.key}", "{2.key}", "{3.key}");

comment:24 by Famlam, 3 years ago

But, wait a minute. This rule is more about a suspicious barrier or access tags missing on either the barrier or the highway:

This part I don't get? It's just checking the barriers (and doesn't warn if the highway itself is already limited, like access=private on the highway, in which case it's not strictly needed to repeat it on the i.e. bollards)?

in reply to:  24 comment:25 by skyper, 3 years ago

Replying to Famlam:

But, wait a minute. This rule is more about a suspicious barrier or access tags missing on either the barrier or the highway:

This part I don't get? It's just checking the barriers (and doesn't warn if the highway itself is already limited, like access=private on the highway, in which case it's not strictly needed to repeat it on the i.e. bollards)?

Damn, I mix-up > and <. < might be the better choice as it selects the barrier and the highway.

comment:26 by Famlam, 3 years ago

But why would you select the highway? ( I'm still confused)

Last edited 3 years ago by Famlam (previous) (diff)

comment:27 by skyper, 3 years ago

Sorry, I forgot about the simplicity of this rule and was still thinking about complex cases where access tag mismatch or a highway does not have access tags but the barrier has e.g. motor_vehicle=private.

in reply to:  22 comment:28 by reichg, 3 years ago

Replying to Famlam:

May I propose to combine
[barrier!=entrance][barrier!~/border_control|height_restrictor|toll_booth/]
to
[barrier!~/entrance|border_control|height_restrictor|toll_booth/]?
(or [barrier!~/^(entrance|border_control|height_restrictor|toll_booth)$/])

Yeah easy add, would this complete the ticket or is there anything else?

comment:29 by Famlam, 3 years ago

Yeah easy add, would this complete the ticket or is there anything else?

Thanks!


Well, in terms of wording for the group: I don't know if the "barrier tags" are suspicious (which barrier tag*s*, note the plural, as there's only one barrier tag). Perhaps simply "suspicious barrier", as the barrier is the suspicious object


I don't think you can do assert(No)Match with a node on a way*; I'd just leave those asserts out.
(* That is, I haven't figured it out)

by reichg, 3 years ago

Attachment: 20742_v7.patch added

suspicious barrier and removed asserts.

comment:30 by skyper, 3 years ago

  • I'd still like to get a warning if on a way's middle node, the barrier has access restrictions but the highway does not have any
  • Barriers on intersections with more than two highways or on T-intersections (one way's middle node plus one end node) are suspicious, too.

comment:31 by Famlam, 3 years ago

@reichg, looks good to me :)

@skyper, I think it doesn't prevent this patch from being merged, right?
Both of those should only apply to major roads too:

  • a residential with a bollard in the middle is not uncommon; it's just a normal dead-end-for-cars from two sides
  • a bollard on a cycleway where a footway connects is also not odd; the cycleway may be split there due to i.e. relations or different values of surface or such, causing false positives.

And then I can only think of very few cases where the current issue wouldn't already say there's something odd at the location of the barrier. Do you have an example perhaps?

comment:32 by skyper, 3 years ago

No, the patch is fine and one part which can be applied as the first step, thanks.

  • please, remove the leading space of the search expression
  • as already mentioned the warning can include more parts of the expression:
        throwWarning: tr("{0} without {1} tags such as {1}, {2}, or {3}.", "{0.tag}", "{2.key}", "{3.key}", "{4.key}");
    

For the barrier on middle node of highway=tertiary, I have to dig through my CS-comments. I remember at least two cases:

  1. a mapping error using barrier=lift_gate instead of railway=level_crossing, crossing:barrier=*. This is covered by the patch.
  2. a mapping error adding barrier=gate, access=private on the intersection with a highway=service instead of on a different node only part of the service road.

Maybe, barrier=bollard is a special case but at least some barriers are usually not placed at the intersection. How about a white list instead of a blacklist?
I can see, that we can get problems with highway=service and below but a residential road with a service road leading of and a barrier=gate at the intersection is odd.

comment:33 by skyper, 3 years ago

Just found this node even without a barrier tag.

in reply to:  33 ; comment:34 by Famlam, 3 years ago

Replying to skyper:

Just found this node even without a barrier tag.

Made #21341 for that (as it's a different issue).


a mapping error adding barrier=gate, access=private on the intersection with a highway=service instead of on a different node only part of the service road.

Something like this?

way[highway=~/^(footway|path|bridleway|cycleway|service)$/] >node[barrier]:connection {
        set .barrierSmallRoadConnection;
}
way[highway=~/^(unclassified|residential)$/] >[index = 1] node.barrierSmallRoadConnection,
way[highway=~/^(unclassified|residential)$/] >[index = -1] node.barrierSmallRoadConnection {
        set .barrierAllowedAtConnection;
}
/* 20742; warnings for major roads set by other rule, also issue 20742 */
way[highway=~/^(unclassified|residential)$/] > node[barrier][barrier!=bollard][!access][!access:conditional][!vehicle][!vehicle:conditional][!motor_vehicle][!motor_vehicle:conditional].barrierSmallRoadConnection!.barrierAllowedAtConnection {
        throwWarning: tr("Suspicious {0} on a connection of a small highway with a larger highway", "{0.tag}");
        set .hasWarningForBarrierOnWay;
}
way[highway=~/^(unclassified|residential)$/] > node[barrier].barrierSmallRoadConnection!.hasWarningForBarrierOnWay {
        throwOther: tr("Suspicious {0} on a connection of a small highway with a larger highway", "{0.tag}");
}
Last edited 3 years ago by Famlam (previous) (diff)

in reply to:  34 comment:35 by reichg, 3 years ago

a mapping error adding barrier=gate, access=private on the intersection with a highway=service instead of on a different node only part of the service road.

Something like this?
[EDIT FAMLAM: I cut the code out to make sure the correct one is copied]

Has this been tested? I can test some of this and add it to the patch.

Last edited 3 years ago by Famlam (previous) (diff)

comment:36 by Famlam, 3 years ago

I've updated it (in the original comment), as there was an issue with when a residential continued as cycleway, for instance. It would be nice to test it and put it in the patch indeed!

Last edited 3 years ago by Famlam (previous) (diff)

in reply to:  34 comment:37 by reichg, 3 years ago

a mapping error adding barrier=gate, access=private on the intersection with a highway=service instead of on a different node only part of the service road.

Something like this?

way[highway=~/^(footway|path|bridleway|cycleway|service)$/] >node[barrier]:connection {
        set .barrierSmallRoadConnection;
}
way[highway=~/^(unclassified|residential)$/] >[index = 1] node.barrierSmallRoadConnection,
way[highway=~/^(unclassified|residential)$/] >[index = -1] node.barrierSmallRoadConnection {
        set .barrierAllowedAtConnection;
}
/* 20742; warnings for major roads set by other rule, also issue 20742 */
way[highway=~/^(unclassified|residential)$/] > node[barrier][barrier!=bollard][!access][!access:conditional][!vehicle][!vehicle:conditional][!motor_vehicle][!motor_vehicle:conditional].barrierSmallRoadConnection!.barrierAllowedAtConnection {
        throwWarning: tr("Suspicious {0} on a connection of a small highway with a larger highway", "{0.tag}");
        set .hasWarningForBarrierOnWay;
}
way[highway=~/^(unclassified|residential)$/] > node[barrier].barrierSmallRoadConnection!.hasWarningForBarrierOnWay {
        throwOther: tr("Suspicious {0} on a connection of a small highway with a larger highway", "{0.tag}");
}

One suggestion would be to adjust the warning to be more descriptive? Isn't this also an issue of having barriers on nodes which are not end nodes? Should that be mentioned in the warning?

I have looked at a few scenarios and this seems to be working as expected.
Need another pair of eyes to look at this and test it.

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

by reichg, 3 years ago

Attachment: 20742_v8.patch added

including lower class roads that famlam introduced

comment:38 by Famlam, 3 years ago

Isn't this also an issue of having barriers on nodes which are not end nodes? Should that be mentioned in the warning?

A barrier in the middle of a (non-major) road is not per se an issue. Think of i.e. a cycle barrier on a footway or a bollard on a residential. Besides, by suggesting it should be an end node, people will just cut the road in two, thereby not resolving any issue.

including lower class roads that famlam introduced

Thanks! I realized I forgot to add:
group: tr("suspicious barrier");
after the throwWarning and throwOther, sorry :S

in reply to:  38 ; comment:39 by skyper, 3 years ago

@Gabe
Please, use as much placeholders as possible in the warning:
throwWarning: tr("{0} without {1} tags such as {1}, {2}, or {3}.", "{0.tag}", "{2.key}", "{3.key}", "{4.key}");

Replying to Famlam:

including lower class roads that famlam introduced

Thanks! I realized I forgot to add:
group: tr("suspicious barrier");
after the throwWarning and throwOther, sorry :S

Sorry, I already included this in my local copy but never wrote about it.
I think, common practice is to add the name with set without a leading . which is optional.
Maybe we can even display the highway values in the warnings with parent_tags() similar to trunk/resources/data/validator/geometry.mapcss?rev=18175#L234

comment:40 by Famlam, 3 years ago

Maybe we can even display the highway values in the warnings with parent_tags() similar to trunk/resources/data/validator/geometry.mapcss?rev=18175#L234​

In this case, with connecting roads, there will be multiple parents; I'm not sure how to extract the correct ones in "mapcss language"

by reichg, 3 years ago

Attachment: 20742_v9.patch added

Everything except the usage of parent tags. Not sure how to get the proper parent tag if there are multiple parents.

in reply to:  39 comment:41 by reichg, 3 years ago

Replying to skyper:

@Gabe
Please, use as much placeholders as possible in the warning:
throwWarning: tr("{0} without {1} tags such as {1}, {2}, or {3}.", "{0.tag}", "{2.key}", "{3.key}", "{4.key}");

I totally forgot how these worked. :) Got it now.

by Famlam, 3 years ago

Attachment: 20742_v10.patch added

With group on the second part of the patch & indentation made consistent :)

comment:42 by reichg, 3 years ago

do we all agree that this last patch satisfies the ticket? Not sure what we can do about adding the parent tags into the warning message.

comment:43 by skyper, 3 years ago

highway values are not important and I spend my time on #20530 instead of playing around with filtering the output of parent_tags() nor deeper testing these new rules.

The indentation is still off at the second line with the leading space but besides of this glitch, I think it is ready for commit.

by reichg, 3 years ago

Attachment: 20742_v11.patch added

indentation fix

comment:44 by reichg, 3 years ago

Milestone: 21.09

comment:45 by Don-vip, 3 years ago

Resolution: fixed
Status: newclosed

In 18231/josm:

fix #20742 - warns about barrier with inappropriate access tags on highway (patch by reichg)

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

comment:46 by Famlam, 3 years ago

Poor me, not listed :P

in reply to:  30 ; comment:47 by aceman, 3 years ago

Replying to skyper:

  • I'd still like to get a warning if on a way's middle node, the barrier has access restrictions but the highway does not have any

That is not strictly an error, there may be a gate or a bollard in the middle of the roads, while cars can still freely come to the barrier from both sides (thus no access tags on the highway). Would you require to split the road to silence the warning?

in reply to:  47 comment:48 by skyper, 3 years ago

Replying to aceman:

Replying to skyper:

  • I'd still like to get a warning if on a way's middle node, the barrier has access restrictions but the highway does not have any

That is not strictly an error, there may be a gate or a bollard in the middle of the roads, while cars can still freely come to the barrier from both sides (thus no access tags on the highway). Would you require to split the road to silence the warning?

Yes, but only on minor roads, right?
Do you find false positives with r18235?

comment:49 by Don-vip, 3 years ago

Milestone: 21.0921.10

Milestone renamed

comment:50 by skyper, 3 years ago

I get several warnings for one node now, see #21548.

in reply to:  50 comment:51 by skyper, 3 years ago

Replying to skyper:

I get several warnings for one node now, see #21548.

Sorry, user fault. Works as expected with proper setting.

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.