Changes between Initial Version and Version 1 of Rules/KeepRight


Ignore:
Timestamp:
2019-03-22T16:35:14+01:00 (7 years ago)
Author:
abalosc1
Comment:

KeepRight written as MapCSS checks

Legend:

Unmodified
Added
Removed
Modified
  • Rules/KeepRight

    v1 v1  
     1{{{
     2#!rule
     3meta
     4{
     5  title: "KeepRight Checks";
     6  version: "[[revision]]_[[date]]";
     7  description: "Checks for errors based on KeepRight checks";
     8  author: "Dave Manzer";
     9  watch-modified: true;
     10  link: "https://www.keepright.at/";
     11  min-josm-version: 14481; 
     12}
     13
     14/* Keep Right Checks for JOSM */
     15
     16/* KeepRight dead ended oneways 040 */
     17way[highway] node:connection {
     18        set kr_node;
     19}
     20
     21way[highway] node:in-downloaded-area {
     22        set kr_downloaded;
     23}
     24
     25way[highway] node:new {
     26        set kr_new_node;
     27}
     28
     29way[building] node:connection,
     30way[amenity=parking] node:connection,
     31way[amenity=parking_entrance] node:connection {
     32        set exception;
     33}
     34
     35/* 040 Message: The first node (id $1) of this one-way is not connected to any other way */
     36way[oneway][oneway!=no][highway][highway!~/path|track|footway|construction/]!:closed!.kr_node.kr_downloaded >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking],
     37way[oneway][oneway!=no][highway][highway!~/path|track|footway|construction/]!:closed!.kr_node.kr_new_node >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking] {
     38        throwWarning: tr("040: dead ended oneway at first node");
     39        group: tr("KeepRight");
     40}
     41
     42/* 041 Message: The last node (id $1) of this one-way is not connected to any other way */
     43way[oneway][oneway!=no][highway][highway!~/path|track|footway|construction/]!:closed!.kr_node.kr_downloaded >[index=-1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking],
     44way[oneway][oneway!=no][highway][highway!~/path|track|footway|construction/]!:closed!.kr_node.kr_new_node >[index=-1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking] {
     45        throwWarning: tr("041: dead ended oneway at last node");
     46        group: tr("KeepRight");
     47}
     48
     49/* 042 Message: This node cannot be reached, because one-ways only lead away from here */
     50way[highway][oneway=yes] >[index!=1] node:connection {
     51        set con_042;
     52}
     53
     54way[highway][oneway!=yes] node:connection {
     55        set hwycon_042;
     56}
     57
     58way[highway][oneway=yes] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking]:connection!.con_042!.hwycon_042.kr_downloaded!.exception {
     59        throwWarning: tr("042: This node cannot be reached. One-ways only lead away from here");
     60        group: tr("KeepRight");
     61}
     62
     63/* oneway=-1 */
     64way[highway][oneway=yes] >[index=1] node:connection {
     65        set negative_oneway;
     66}
     67
     68way[highway][!oneway] node:connection {
     69        set ow;
     70}
     71
     72way[highway][oneway=-1] >[index=-1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking]:connection!.ow.negative_oneway!.con_042.kr_downloaded!.exception {
     73        throwWarning: tr("042: This node cannot be reached. One-ways only lead away from here");
     74        group: tr("KeepRight");
     75}
     76
     77/* 043 Message: This node cannot be reached, because one-ways only lead to here */
     78
     79way[highway][oneway=yes] >[index!=-1] node:connection {
     80        set con_043;
     81}
     82
     83way[highway][oneway!=yes] node:connection {
     84        set hwycon_043;
     85}
     86
     87way[highway][oneway=yes] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking]:connection!.con_043!.hwycon_043.kr_downloaded!.exception {
     88        throwWarning: tr("043: You cannot escape from this node. One-ways only lead to here");
     89        group: tr("KeepRight");
     90}
     91
     92/* oneway=-1 */
     93
     94way[highway][oneway=yes] >[index=-1] node:connection {
     95        set negative_oneway2;
     96}
     97
     98
     99way[highway][oneway=-1] >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking]:connection!.ow.negative_oneway2!.con_043.kr_downloaded!.exception {
     100        throwWarning: tr("043: You cannot escape from this node. One-ways only lead to here");
     101        group: tr("KeepRight");
     102}
     103
     104/* Keep Right/160 wrongly used railway crossing tag -- Partially Complete*/
     105/* Message: There are ways in different layers coming together in this railway crossing */
     106
     107way[highway][layer][layer!=0] node:connection {
     108        set kr_160_1;
     109}
     110
     111way[railway][!layer].kr_160_1 node[railway=level_crossing] {
     112        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     113        group: "KeepRight";
     114}
     115
     116way[railway][layer] node:connection {
     117        set kr_160_1;
     118}
     119
     120way[highway][!layer].kr_160_1 node[railway=level_crossing] {
     121        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     122        group: "KeepRight";
     123}
     124way[highway][layer=-5] node:connection,
     125way[railway][layer=-5] node:connection {
     126        set lyr_n5;
     127}
     128
     129way[railway][layer][layer!=-5] node.lyr_n5[railway=level_crossing],
     130way[highway][layer][layer!=-5] node.lyr_n5[railway=level_crossing] {
     131        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     132        group: "KeepRight";
     133}
     134
     135way[highway][layer=-4] node:connection,
     136way[railway][layer=-4] node:connection {
     137        set lyr_n4;
     138}
     139
     140way[railway][layer][layer!=-4] node.lyr_n4[railway=level_crossing],
     141way[highway][layer][layer!=-4] node.lyr_n4[railway=level_crossing] {
     142        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     143        group: "KeepRight";
     144}
     145
     146way[highway][layer=-3] node:connection,
     147way[railway][layer=-3] node:connection {
     148        set lyr_n3;
     149}
     150
     151way[railway][layer][layer!=-3] node.lyr_n3[railway=level_crossing],
     152way[highway][layer][layer!=-3] node.lyr_n3[railway=level_crossing] {
     153        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     154        group: "KeepRight";
     155}
     156
     157way[highway][layer=-2] node:connection,
     158way[railway][layer=-2] node:connection {
     159        set lyr_n2;
     160}
     161
     162way[railway][layer][layer!=-2] node.lyr_n2[railway=level_crossing],
     163way[highway][layer][layer!=-2] node.lyr_n2[railway=level_crossing] {
     164        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     165        group: "KeepRight";
     166}
     167
     168way[highway][layer=-1] node:connection,
     169way[railway][layer=-1] node:connection {
     170        set lyr_n1;
     171}
     172
     173way[railway][layer][layer!=-1] node.lyr_n1[railway=level_crossing],
     174way[highway][layer][layer!=-1] node.lyr_n1[railway=level_crossing] {
     175        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     176        group: "KeepRight";
     177}
     178
     179way[highway][layer=1] node:connection,
     180way[railway][layer=1] node:connection {
     181        set lyr_1;
     182}
     183
     184way[railway][layer][layer!=1] node.lyr_1[railway=level_crossing],
     185way[highway][layer][layer!=1] node.lyr_1[railway=level_crossing] {
     186        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     187        group: "KeepRight";
     188}
     189
     190way[highway][layer=2] node:connection,
     191way[railway][layer=2] node:connection {
     192        set lyr_2;
     193}
     194
     195way[railway][layer][layer!=2] node.lyr_2[railway=level_crossing],
     196way[highway][layer][layer!=2] node.lyr_2[railway=level_crossing] {
     197        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     198        group: "KeepRight";
     199}
     200
     201way[highway][layer=3] node:connection,
     202way[railway][layer=3] node:connection {
     203        set lyr_3;
     204}
     205
     206way[railway][layer][layer!=3] node.lyr_3[railway=level_crossing],
     207way[highway][layer][layer!=3] node.lyr_3[railway=level_crossing] {
     208        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     209        group: "KeepRight";
     210}
     211
     212way[highway][layer=4] node:connection,
     213way[railway][layer=4] node:connection {
     214        set lyr_4;
     215}
     216
     217way[railway][layer][layer!=4] node.lyr_4[railway=level_crossing],
     218way[highway][layer][layer!=4] node.lyr_4[railway=level_crossing] {
     219        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     220        group: "KeepRight";
     221}
     222
     223way[highway][layer=5] node:connection,
     224way[railway][layer=5] node:connection {
     225        set lyr_5;
     226}
     227
     228way[railway][layer][layer!=5] node.lyr_5[railway=level_crossing],
     229way[highway][layer][layer!=5] node.lyr_5[railway=level_crossing] {
     230        throwWarning: tr("160: wrongly used railway crossing tag - different layer tags on connecting ways");
     231        group: "KeepRight";
     232}
     233
     234/* Message: There are ways tagged as tunnel or bridge coming together in this railway crossing */
     235way[highway][bridge] node:connection,
     236way[highway][tunnel] node:connection {
     237        set kr_160_2;
     238}
     239
     240way[railway].kr_160_2 node[railway=level_crossing] {
     241        throwWarning: tr("160: wrongly used railway crossing tag - connection on bridge or tunnel");
     242        group: "KeepRight";
     243}
     244
     245way[railway][bridge] node:connection,
     246way[railway][tunnel] node:connection {
     247        set kr_160_3;
     248}
     249
     250way[highway].kr_160_3 node[railway=level_crossing] {
     251        throwWarning: tr("160: wrongly used railway crossing tag - connection on bridge or tunnel");
     252        group: "KeepRight";
     253}
     254
     255
     256/* Keep Right fixme tagged items - 170 */
     257
     258*[fixme] {
     259        throwWarning: tr("170: fixme tagged items");
     260        group: "KeepRight";
     261}
     262
     263*[name=~/(?i).*tbd/] {
     264        throwWarning: tr("170: fixme tagged items; change {0} value", "{0.key}");
     265        group: "KeepRight";
     266}
     267
     268*[ref=~/(?i).*tbd/] {
     269        throwWarning: tr("170: fixme tagged items; change {0} value", "{0.key}");
     270        group: "KeepRight";
     271}
     272
     273
     274/* Keep Right layer conflicts 230 -- Partially Complete */
     275
     276/* 231 mixed layers intersections */
     277
     278way[highway][layer][layer!=0] node:connection {
     279        set kr_230_connection;
     280}
     281
     282way[highway][layer] >[index=-1] node,
     283way[highway][layer] >[index=1] node {
     284        set fl_node230;
     285}
     286
     287way[highway][!layer] node!.fl_node230.kr_230_connection {
     288        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     289        group: "KeepRight";
     290}
     291
     292way[highway][layer=-5] node:connection {
     293        set lyrn5;
     294}
     295
     296way[highway][layer][layer!=-5] node!.fl_node230.lyrn5 {
     297        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     298        group: "KeepRight";
     299}
     300
     301way[highway][layer=-4] node:connection {
     302        set lyrn4;
     303}
     304
     305way[highway][layer][layer!=-4] node!.fl_node230.lyrn4 {
     306        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     307        group: "KeepRight";
     308}
     309
     310
     311way[highway][layer=-3] node:connection {
     312        set lyrn3;
     313}
     314
     315way[highway][layer][layer!=-3] node!.fl_node230.lyrn3 {
     316        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     317        group: "KeepRight";
     318}
     319
     320way[highway][layer=-2] node:connection {
     321        set lyrn2;
     322}
     323
     324way[highway][layer][layer!=-2] node!.fl_node230.lyrn2 {
     325        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     326        group: "KeepRight";
     327}
     328
     329way[highway][layer=-1] node:connection {
     330        set lyrn1;
     331}
     332
     333way[highway][layer][layer!=-1] node!.fl_node230.lyrn1 {
     334        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     335        group: "KeepRight";
     336}
     337
     338way[highway][layer=1] node:connection {
     339        set lyr1;
     340}
     341
     342way[highway][layer][layer!=1] node!.fl_node230.lyr1 {
     343        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     344        group: "KeepRight";
     345}
     346
     347way[highway][layer=2] node:connection {
     348        set lyr2;
     349}
     350
     351way[highway][layer][layer!=2] node!.fl_node230.lyr2 {
     352        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     353        group: "KeepRight";
     354}
     355
     356way[highway][layer=3] node:connection {
     357        set lyr3;
     358}
     359
     360way[highway][layer][layer!=3] node!.fl_node230.lyr3 {
     361        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     362        group: "KeepRight";
     363}
     364
     365way[highway][layer=4] node:connection {
     366        set lyr4;
     367}
     368
     369way[highway][layer][layer!=4] node!.fl_node230.lyr4 {
     370        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     371        group: "KeepRight";
     372}
     373
     374way[highway][layer=5] node:connection {
     375        set lyr5;
     376}
     377
     378way[highway][layer][layer!=5] node!.fl_node230.lyr5 {
     379        throwWarning: tr("231: layer conflicts; mixed layer intersection");
     380        group: "KeepRight";
     381}
     382
     383/* 232 strange layer */
     384
     385way[bridge][layer ^= "-"] {
     386        throwWarning: tr("232: strange layer; {0} with negative layer", "{0.key}");
     387        group: "KeepRight";
     388}
     389
     390way[tunnel][layer][layer!~/-/] {
     391        throwWarning: tr("232: strange layer; {0} with positive layer", "{0.key}");
     392        group: "KeepRight";
     393}
     394
     395/* Keep Right motorways connected directly 270 */
     396/* Message: This node is a junction of a motorway and a highway other than motorway, motorway_link, trunk, rest_area or construction.
     397Service or unclassified is only valid if it has access=no/private or if it is a service=parking_aisle. */
     398
     399way[highway=motorway] >[index=1] node:connection,
     400way[highway=motorway] >[index=-1] node:connection {
     401        set kr_270_end_motorway;
     402}
     403
     404way[highway][highway!=motorway] node:connection {
     405        set hwycon270;
     406}
     407
     408/* allowed junctions */
     409way[highway=service][access=no] node:connection,
     410way[highway=service][access=private] node:connection,
     411way[highway=service][service=parking_aisle] node:connection,
     412way[highway=unclassified][access=no] node:connection,
     413way[highway=unclassified][access=private] node:connection,
     414way[highway=unclassified][service=parking_aisle] node:connection,
     415way[highway=motorway_link] node:connection,
     416way[highway=motorway_junction] node:connection,
     417way[highway=construction] node:connection,
     418way[highway=proposed] node:connection {
     419        set kr_270_allowed;
     420}
     421
     422way[highway=motorway] node:connection.hwycon270!.kr_270_allowed!.kr_270_end_motorway {
     423        throwWarning: tr("270: motorways connected directly");
     424        group: "KeepRight";
     425}
     426
     427/* KeepRight missing maxspeed 300 */
     428/* Message: missing maxspeed tag */
     429way[highway=~/^(motorway|trunk|primary|secondary)$/][junction!=roundabout][!bridge][!tunnel][!maxspeed] {
     430        throwOther: tr("300: missing maxspeed on major road");
     431        group: "KeepRight";
     432}
     433
     434/* Building Crossing Highway Atlas Check */
     435
     436way[highway][highway=~/^(motorway|trunk|primary|secondary|tertiary|unclassified|residential|service|motorway_link|trunk_link|primary_link|secondary_link|tertiary_link|living_street|track|road)$/] node:connection {
     437        set atlas_highway;
     438}
     439
     440way[highway][tunnel=yes] node:connection,
     441way[highway][tunnel=building_passage] node:connection,
     442way[highway][covered=yes] node:connection,
     443way[highway][indoor=yes] node:connection,
     444way[highway][service=driveway] node:connection {
     445        set atlas_allowed;
     446}
     447
     448*[building][building!=roof][amenity!=fuel].atlas_highway!.atlas_allowed node[amenity!=parking_entrance][amenity!=parking][!barrier][entrance!=yes] {
     449        throwWarning: tr("Building Road Intersection Check: building connected to road");
     450        group: tr("Atlas");
     451}
     452
     453}}}