Ticket #19609: josm_19609_wip.patch

File josm_19609_wip.patch, 4.8 KB (added by skyper, 6 years ago)

first patch still needs some testing and some cases are missing.

  • resources/data/validator/combinations.mapcss

     
    7272*[source:addr:postcode         ][!addr:postcode],
    7373*[source:addr:housenumber      ][!addr:housenumber] {
    7474  throwWarning: tr("{0} without {1}", "{0.key}", "{1.key}");
    75   set MissingKeyWarning;
    7675  group: tr("missing tag");
    7776  assertMatch: "way lanes=42";
    7877  assertNoMatch: "way lanes=42 highway=unclassified";
     
    605604}
    606605
    607606/* see #8519, #11529, limited to motorways and trunks to avoid false positives for streets with lanes for non motorized traffic */
    608 way[highway =~ /^(motorway|motorway_link|trunk|trunk_link)$/][lanes][turn:lanes              ][tag(lanes)!=eval(count(split("|", tag("turn:lanes"))))],
    609 way[highway =~ /^(motorway|motorway_link|trunk|trunk_link)$/][lanes][change:lanes            ][tag(lanes)!=eval(count(split("|", tag("change:lanes"))))],
    610 way[highway =~ /^(motorway|motorway_link|trunk|trunk_link)$/][lanes][maxspeed:lanes          ][tag(lanes)!=eval(count(split("|", tag("maxspeed:lanes"))))],
    611 way[highway =~ /^(motorway|motorway_link|trunk|trunk_link)$/][lanes][minspeed:lanes          ][tag(lanes)!=eval(count(split("|", tag("minspeed:lanes"))))],
    612 way[highway =~ /^(motorway|motorway_link|trunk|trunk_link)$/][lanes][destination:lanes       ][tag(lanes)!=eval(count(split("|", tag("destination:lanes"))))],
    613 way[highway =~ /^(motorway|motorway_link|trunk|trunk_link)$/][lanes][destination:ref:lanes   ][tag(lanes)!=eval(count(split("|", tag("destination:ref:lanes"))))],
    614 way[highway =~ /^(motorway|motorway_link|trunk|trunk_link)$/][lanes][destination:symbol:lanes][tag(lanes)!=eval(count(split("|", tag("destination:symbol:lanes"))))] {
     607way[highway =~ /^(motorway|motorway_link|trunk|trunk_link)$/] {
     608  set MotorwayTrunk;
     609}
     610way.MotorwayTrunk[lanes][turn:lanes              ][tag(lanes)!=eval(count(split("|", tag("turn:lanes"))))],
     611way.MotorwayTrunk[lanes][change:lanes            ][tag(lanes)!=eval(count(split("|", tag("change:lanes"))))],
     612way.MotorwayTrunk[lanes][maxspeed:lanes          ][tag(lanes)!=eval(count(split("|", tag("maxspeed:lanes"))))],
     613way.MotorwayTrunk[lanes][minspeed:lanes          ][tag(lanes)!=eval(count(split("|", tag("minspeed:lanes"))))],
     614way.MotorwayTrunk[lanes][destination:lanes       ][tag(lanes)!=eval(count(split("|", tag("destination:lanes"))))],
     615way.MotorwayTrunk[lanes][destination:ref:lanes   ][tag(lanes)!=eval(count(split("|", tag("destination:ref:lanes"))))],
     616way.MotorwayTrunk[lanes][destination:symbol:lanes][tag(lanes)!=eval(count(split("|", tag("destination:symbol:lanes"))))] {
    615617    throwWarning: tr("Different number of lanes in the keys {0} and {1}", "{1.key}", "{2.key}");
    616618    group: tr("suspicious tag combination");
    617619}
    618620
    619621/* #14125, #14323, #18185 */
    620 way[highway][lanes][!lanes:forward][!lanes:backward][oneway!=yes][oneway!=-1][oneway!=reversible][junction!=roundabout][lanes>2][get(split(".", tag(lanes)/2), 1)=5] {
     622way[highway][lanes][!lanes:forward][!lanes:backward][oneway!=yes][oneway!=-1][oneway!=reversible][highway!=motorway][junction!=roundabout][lanes>2][get(split(".", tag(lanes)/2), 1)=5] {
    621623  throwWarning: tr("street with odd number of {0}, but without {1} and {2} or {3}", "{1.key}", "{2.key}", "{3.key}", "{4.key}");
    622624  group: tr("missing tag");
    623625  assertNoMatch: "way highway=primary lanes=2";
     
    627629  assertMatch: "way highway=primary lanes=3";
    628630}
    629631
    630 /* #10932 */
    631 way[highway][!lanes][/^.*:lanes$/]!.MissingKeyWarning,
    632 way[highway][!lanes:forward][/^.*:lanes:forward$/],
    633 way[highway][!lanes:backward][/^.*:lanes:backward$/],
     632/* #10932, #19609 */
     633way[highway][!lanes][/^.*:lanes$/][!source:lanes],
     634way[highway][!lanes][/^.*:lanes:(forward|backward|both_ways)$/],
    634635way[highway][!lanes:both_ways][/^.*:lanes:both_ways$/] {
    635   throwWarning: tr("{0} without {1}", "{2.key}", "{1.key}");
     636  throwWarning: tr("`{0}` without `{1}`., "{2.key}=*", "{1.key}=*");
    636637  group: tr("missing tag");
    637638  assertMatch: "way highway=primary turn:lanes=left|right";
    638   assertNoMatch: "way highway=primary turn:lanes=left|right lanes=2";
    639639  assertMatch: "way highway=primary turn:lanes:forward=left|right";
     640  assertNoMatch: "way highway=primary turn:lanes=left|right lanes=2";
     641}
     642way[highway][!lanes:forward][/^.*:lanes:forward$/][!lanes:backward][!get(split(".", tag(lanes)/2), 1)=5],
     643way[highway][!lanes:backward][/^.*:lanes:backward$/][!lanes:forward][!get(split(".", tag(lanes)/2), 1)=5] {
     644  throwOther: tr("`{0}` without `{1}`.", "{2.key}=*", "{1.key}=*");
     645  group: tr("missing tag");
     646  assertMatch: "way highway=primary turn:lanes:forward=left|right lanes=2";
    640647  assertNoMatch: "way highway=primary turn:lanes:forward=left|right lanes:forward=2";
     648  assertNoMatch: "way highway=primary turn:lanes:forward=left|right lanes=3";
    641649}
    642650
    643651/* #15774 */