| | 1 | {{{ |
| | 2 | #!rule |
| | 3 | meta |
| | 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 */ |
| | 17 | way[highway] node:connection { |
| | 18 | set kr_node; |
| | 19 | } |
| | 20 | |
| | 21 | way[highway] node:in-downloaded-area { |
| | 22 | set kr_downloaded; |
| | 23 | } |
| | 24 | |
| | 25 | way[highway] node:new { |
| | 26 | set kr_new_node; |
| | 27 | } |
| | 28 | |
| | 29 | way[building] node:connection, |
| | 30 | way[amenity=parking] node:connection, |
| | 31 | way[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 */ |
| | 36 | way[oneway][oneway!=no][highway][highway!~/path|track|footway|construction/]!:closed!.kr_node.kr_downloaded >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking], |
| | 37 | way[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 */ |
| | 43 | way[oneway][oneway!=no][highway][highway!~/path|track|footway|construction/]!:closed!.kr_node.kr_downloaded >[index=-1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking], |
| | 44 | way[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 */ |
| | 50 | way[highway][oneway=yes] >[index!=1] node:connection { |
| | 51 | set con_042; |
| | 52 | } |
| | 53 | |
| | 54 | way[highway][oneway!=yes] node:connection { |
| | 55 | set hwycon_042; |
| | 56 | } |
| | 57 | |
| | 58 | way[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 */ |
| | 64 | way[highway][oneway=yes] >[index=1] node:connection { |
| | 65 | set negative_oneway; |
| | 66 | } |
| | 67 | |
| | 68 | way[highway][!oneway] node:connection { |
| | 69 | set ow; |
| | 70 | } |
| | 71 | |
| | 72 | way[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 | |
| | 79 | way[highway][oneway=yes] >[index!=-1] node:connection { |
| | 80 | set con_043; |
| | 81 | } |
| | 82 | |
| | 83 | way[highway][oneway!=yes] node:connection { |
| | 84 | set hwycon_043; |
| | 85 | } |
| | 86 | |
| | 87 | way[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 | |
| | 94 | way[highway][oneway=yes] >[index=-1] node:connection { |
| | 95 | set negative_oneway2; |
| | 96 | } |
| | 97 | |
| | 98 | |
| | 99 | way[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 | |
| | 107 | way[highway][layer][layer!=0] node:connection { |
| | 108 | set kr_160_1; |
| | 109 | } |
| | 110 | |
| | 111 | way[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 | |
| | 116 | way[railway][layer] node:connection { |
| | 117 | set kr_160_1; |
| | 118 | } |
| | 119 | |
| | 120 | way[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 | } |
| | 124 | way[highway][layer=-5] node:connection, |
| | 125 | way[railway][layer=-5] node:connection { |
| | 126 | set lyr_n5; |
| | 127 | } |
| | 128 | |
| | 129 | way[railway][layer][layer!=-5] node.lyr_n5[railway=level_crossing], |
| | 130 | way[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 | |
| | 135 | way[highway][layer=-4] node:connection, |
| | 136 | way[railway][layer=-4] node:connection { |
| | 137 | set lyr_n4; |
| | 138 | } |
| | 139 | |
| | 140 | way[railway][layer][layer!=-4] node.lyr_n4[railway=level_crossing], |
| | 141 | way[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 | |
| | 146 | way[highway][layer=-3] node:connection, |
| | 147 | way[railway][layer=-3] node:connection { |
| | 148 | set lyr_n3; |
| | 149 | } |
| | 150 | |
| | 151 | way[railway][layer][layer!=-3] node.lyr_n3[railway=level_crossing], |
| | 152 | way[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 | |
| | 157 | way[highway][layer=-2] node:connection, |
| | 158 | way[railway][layer=-2] node:connection { |
| | 159 | set lyr_n2; |
| | 160 | } |
| | 161 | |
| | 162 | way[railway][layer][layer!=-2] node.lyr_n2[railway=level_crossing], |
| | 163 | way[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 | |
| | 168 | way[highway][layer=-1] node:connection, |
| | 169 | way[railway][layer=-1] node:connection { |
| | 170 | set lyr_n1; |
| | 171 | } |
| | 172 | |
| | 173 | way[railway][layer][layer!=-1] node.lyr_n1[railway=level_crossing], |
| | 174 | way[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 | |
| | 179 | way[highway][layer=1] node:connection, |
| | 180 | way[railway][layer=1] node:connection { |
| | 181 | set lyr_1; |
| | 182 | } |
| | 183 | |
| | 184 | way[railway][layer][layer!=1] node.lyr_1[railway=level_crossing], |
| | 185 | way[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 | |
| | 190 | way[highway][layer=2] node:connection, |
| | 191 | way[railway][layer=2] node:connection { |
| | 192 | set lyr_2; |
| | 193 | } |
| | 194 | |
| | 195 | way[railway][layer][layer!=2] node.lyr_2[railway=level_crossing], |
| | 196 | way[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 | |
| | 201 | way[highway][layer=3] node:connection, |
| | 202 | way[railway][layer=3] node:connection { |
| | 203 | set lyr_3; |
| | 204 | } |
| | 205 | |
| | 206 | way[railway][layer][layer!=3] node.lyr_3[railway=level_crossing], |
| | 207 | way[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 | |
| | 212 | way[highway][layer=4] node:connection, |
| | 213 | way[railway][layer=4] node:connection { |
| | 214 | set lyr_4; |
| | 215 | } |
| | 216 | |
| | 217 | way[railway][layer][layer!=4] node.lyr_4[railway=level_crossing], |
| | 218 | way[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 | |
| | 223 | way[highway][layer=5] node:connection, |
| | 224 | way[railway][layer=5] node:connection { |
| | 225 | set lyr_5; |
| | 226 | } |
| | 227 | |
| | 228 | way[railway][layer][layer!=5] node.lyr_5[railway=level_crossing], |
| | 229 | way[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 */ |
| | 235 | way[highway][bridge] node:connection, |
| | 236 | way[highway][tunnel] node:connection { |
| | 237 | set kr_160_2; |
| | 238 | } |
| | 239 | |
| | 240 | way[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 | |
| | 245 | way[railway][bridge] node:connection, |
| | 246 | way[railway][tunnel] node:connection { |
| | 247 | set kr_160_3; |
| | 248 | } |
| | 249 | |
| | 250 | way[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 | |
| | 278 | way[highway][layer][layer!=0] node:connection { |
| | 279 | set kr_230_connection; |
| | 280 | } |
| | 281 | |
| | 282 | way[highway][layer] >[index=-1] node, |
| | 283 | way[highway][layer] >[index=1] node { |
| | 284 | set fl_node230; |
| | 285 | } |
| | 286 | |
| | 287 | way[highway][!layer] node!.fl_node230.kr_230_connection { |
| | 288 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 289 | group: "KeepRight"; |
| | 290 | } |
| | 291 | |
| | 292 | way[highway][layer=-5] node:connection { |
| | 293 | set lyrn5; |
| | 294 | } |
| | 295 | |
| | 296 | way[highway][layer][layer!=-5] node!.fl_node230.lyrn5 { |
| | 297 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 298 | group: "KeepRight"; |
| | 299 | } |
| | 300 | |
| | 301 | way[highway][layer=-4] node:connection { |
| | 302 | set lyrn4; |
| | 303 | } |
| | 304 | |
| | 305 | way[highway][layer][layer!=-4] node!.fl_node230.lyrn4 { |
| | 306 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 307 | group: "KeepRight"; |
| | 308 | } |
| | 309 | |
| | 310 | |
| | 311 | way[highway][layer=-3] node:connection { |
| | 312 | set lyrn3; |
| | 313 | } |
| | 314 | |
| | 315 | way[highway][layer][layer!=-3] node!.fl_node230.lyrn3 { |
| | 316 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 317 | group: "KeepRight"; |
| | 318 | } |
| | 319 | |
| | 320 | way[highway][layer=-2] node:connection { |
| | 321 | set lyrn2; |
| | 322 | } |
| | 323 | |
| | 324 | way[highway][layer][layer!=-2] node!.fl_node230.lyrn2 { |
| | 325 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 326 | group: "KeepRight"; |
| | 327 | } |
| | 328 | |
| | 329 | way[highway][layer=-1] node:connection { |
| | 330 | set lyrn1; |
| | 331 | } |
| | 332 | |
| | 333 | way[highway][layer][layer!=-1] node!.fl_node230.lyrn1 { |
| | 334 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 335 | group: "KeepRight"; |
| | 336 | } |
| | 337 | |
| | 338 | way[highway][layer=1] node:connection { |
| | 339 | set lyr1; |
| | 340 | } |
| | 341 | |
| | 342 | way[highway][layer][layer!=1] node!.fl_node230.lyr1 { |
| | 343 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 344 | group: "KeepRight"; |
| | 345 | } |
| | 346 | |
| | 347 | way[highway][layer=2] node:connection { |
| | 348 | set lyr2; |
| | 349 | } |
| | 350 | |
| | 351 | way[highway][layer][layer!=2] node!.fl_node230.lyr2 { |
| | 352 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 353 | group: "KeepRight"; |
| | 354 | } |
| | 355 | |
| | 356 | way[highway][layer=3] node:connection { |
| | 357 | set lyr3; |
| | 358 | } |
| | 359 | |
| | 360 | way[highway][layer][layer!=3] node!.fl_node230.lyr3 { |
| | 361 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 362 | group: "KeepRight"; |
| | 363 | } |
| | 364 | |
| | 365 | way[highway][layer=4] node:connection { |
| | 366 | set lyr4; |
| | 367 | } |
| | 368 | |
| | 369 | way[highway][layer][layer!=4] node!.fl_node230.lyr4 { |
| | 370 | throwWarning: tr("231: layer conflicts; mixed layer intersection"); |
| | 371 | group: "KeepRight"; |
| | 372 | } |
| | 373 | |
| | 374 | way[highway][layer=5] node:connection { |
| | 375 | set lyr5; |
| | 376 | } |
| | 377 | |
| | 378 | way[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 | |
| | 385 | way[bridge][layer ^= "-"] { |
| | 386 | throwWarning: tr("232: strange layer; {0} with negative layer", "{0.key}"); |
| | 387 | group: "KeepRight"; |
| | 388 | } |
| | 389 | |
| | 390 | way[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. |
| | 397 | Service or unclassified is only valid if it has access=no/private or if it is a service=parking_aisle. */ |
| | 398 | |
| | 399 | way[highway=motorway] >[index=1] node:connection, |
| | 400 | way[highway=motorway] >[index=-1] node:connection { |
| | 401 | set kr_270_end_motorway; |
| | 402 | } |
| | 403 | |
| | 404 | way[highway][highway!=motorway] node:connection { |
| | 405 | set hwycon270; |
| | 406 | } |
| | 407 | |
| | 408 | /* allowed junctions */ |
| | 409 | way[highway=service][access=no] node:connection, |
| | 410 | way[highway=service][access=private] node:connection, |
| | 411 | way[highway=service][service=parking_aisle] node:connection, |
| | 412 | way[highway=unclassified][access=no] node:connection, |
| | 413 | way[highway=unclassified][access=private] node:connection, |
| | 414 | way[highway=unclassified][service=parking_aisle] node:connection, |
| | 415 | way[highway=motorway_link] node:connection, |
| | 416 | way[highway=motorway_junction] node:connection, |
| | 417 | way[highway=construction] node:connection, |
| | 418 | way[highway=proposed] node:connection { |
| | 419 | set kr_270_allowed; |
| | 420 | } |
| | 421 | |
| | 422 | way[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 */ |
| | 429 | way[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 | |
| | 436 | way[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 | |
| | 440 | way[highway][tunnel=yes] node:connection, |
| | 441 | way[highway][tunnel=building_passage] node:connection, |
| | 442 | way[highway][covered=yes] node:connection, |
| | 443 | way[highway][indoor=yes] node:connection, |
| | 444 | way[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 | }}} |