1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615
|
/* measurement values and units warnings (tickets #8687, #15719) */
*[/^[0-9]+$/] {
throwWarning: tr("numerical key");
assertMatch: "way 123=foo";
assertNoMatch: "way ref.1=foo";
}
*[layer =~ /^\+\d/] {
throwWarning: tr("{0} value with + sign", "{0.key}");
fixAdd: concat("layer=", replace(tag("layer"), "+", ""));
assertMatch: "node layer=+1";
assertNoMatch: "node layer=1";
assertNoMatch: "node layer=-1";
assertNoMatch: "node layer=+foo";
}
*[layer][layer !~ /^0$|^(-|\+)?[1-5]$/] {
throwWarning: tr("{0} should be an integer value between -5 and 5", "{0.key}");
assertMatch: "node layer=-50";
assertMatch: "node layer=6";
assertMatch: "node layer=+10";
assertMatch: "node layer=0.5";
assertMatch: "node layer=0;1";
assertNoMatch: "node layer=-5";
assertNoMatch: "node layer=0";
assertNoMatch: "node layer=2";
assertNoMatch: "node layer=+5"; /* this is an invalid value, but this case is already covered by the previous rule */
}
*[building:levels][building:levels !~ /^(([0-9]|[1-9][0-9]*)(\.5)?)$/],
*[level][level !~ /^((((-*[1-9]|[0-9])|-*[1-9][0-9]*)(\.5)?)|-0\.5)(;((((-*[1-9]|[0-9])|-*[1-9][0-9]*)(\.5)?)|-0\.5))*$/] { /* all numbers from -∞ to ∞ in 0.5 steps, optional multiple values separated by a ; */
throwWarning: tr("{0} should have numbers only with optional .5 increments", "{0.key}");
assertMatch: "node level=one";
assertMatch: "node level=01";
assertMatch: "node level=-03";
assertMatch: "node level=-01.5";
assertMatch: "node level=2.3";
assertMatch: "node level=-0";
assertNoMatch: "node level=0";
assertNoMatch: "node level=1";
assertNoMatch: "node level=-1";
assertNoMatch: "node level=-0.5";
assertNoMatch: "node level=1.5";
assertNoMatch: "node level=12";
assertNoMatch: "node level=0;1";
assertNoMatch: "node level=1;1.5";
assertNoMatch: "node level=1;0.5";
assertNoMatch: "node level=0;-0.5";
assertNoMatch: "node level=-0.5;0";
assertNoMatch: "node level=-1;-0.5";
assertNoMatch: "node building:levels=1.5";
assertMatch: "node building:levels=-1";
assertNoMatch: "node building:levels=0"; /* valid because there can be building:levels:underground > 0 or roof:levels > 0 */
}
*[height][height =~ /^[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set height_meter_autofix;
fixAdd: concat("height=", get(regexp_match("([0-9.]+)( )*(.+)",tag("height")),1)," m");
assertMatch: "node height=6.78 meters";
assertMatch: "node height=5 metre";
assertMatch: "node height=2m";
assertNoMatch: "node height=2 m";
assertNoMatch: "node height=5";
}
*[height][height =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set height_foot_autofix;
fixAdd: concat("height=", get(regexp_match("([0-9.]+)( )*(.+)",tag("height")),1)," ft");
assertMatch: "node height=6.78 foot";
assertMatch: "node height=5 Feet";
assertMatch: "node height=2ft";
assertNoMatch: "node height=2 ft";
assertNoMatch: "node height=5";
}
*[height][height =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("height=", replace(tag("height"), ",", "."));
set height_separator_autofix;
assertMatch: "node height=5,5";
assertMatch: "node height=12,00";
assertMatch: "node height=12,5 ft";
assertNoMatch: "node height=12,000";
assertNoMatch: "node height=3,50,5";
assertNoMatch: "node height=3.5";
assertNoMatch: "node height=4";
}
*[maxheight][maxheight =~ /^[1-9][0-9]*(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set maxheight_meter_autofix;
fixAdd: concat("maxheight=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxheight")),1)," m");
assertMatch: "node maxheight=6.78 meters";
assertMatch: "node maxheight=5 metre";
assertMatch: "node maxheight=2m";
assertNoMatch: "node maxheight=2 m";
assertNoMatch: "node maxheight=5";
}
*[maxheight][maxheight =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set maxheight_foot_autofix;
fixAdd: concat("maxheight=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxheight")),1)," ft");
assertMatch: "node maxheight=6.78 foot";
assertMatch: "node maxheight=5 Feet";
assertMatch: "node maxheight=2ft";
assertNoMatch: "node maxheight=2 ft";
assertNoMatch: "node maxheight=5";
}
*[maxheight][maxheight =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("maxheight=", replace(tag("maxheight"), ",", "."));
set maxheight_separator_autofix;
assertMatch: "node maxheight=5,5";
assertMatch: "node maxheight=12,00";
assertMatch: "node maxheight=12,5 ft";
assertNoMatch: "node maxheight=12,000";
assertNoMatch: "node maxheight=3,50,5";
assertNoMatch: "node maxheight=3.5";
assertNoMatch: "node maxheight=4";
}
*[maxlength][maxlength =~ /^[1-9][0-9]*(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set maxlength_meter_autofix;
fixAdd: concat("maxlength=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxlength")),1)," m");
assertMatch: "node maxlength=6.78 meters";
assertMatch: "node maxlength=5 metre";
assertMatch: "node maxlength=2m";
assertNoMatch: "node maxlength=2 m";
assertNoMatch: "node maxlength=5";
}
*[maxlength][maxlength =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set maxlength_foot_autofix;
fixAdd: concat("maxlength=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxlength")),1)," ft");
assertMatch: "node maxlength=6.78 foot";
assertMatch: "node maxlength=5 Feet";
assertMatch: "node maxlength=2ft";
assertNoMatch: "node maxlength=2 ft";
assertNoMatch: "node maxlength=5";
}
*[maxlength][maxlength =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("maxlength=", replace(tag("maxlength"), ",", "."));
set maxlength_separator_autofix;
assertMatch: "node maxlength=5,5";
assertMatch: "node maxlength=12,00";
assertMatch: "node maxlength=12,5 ft";
assertNoMatch: "node maxlength=12,000";
assertNoMatch: "node maxlength=3,50,5";
assertNoMatch: "node maxlength=3.5";
assertNoMatch: "node maxlength=4";
}
*[width][width =~ /^[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set width_meter_autofix;
fixAdd: concat("width=", get(regexp_match("([0-9.]+)( )*(.+)",tag("width")),1)," m");
assertMatch: "node width=6.78 meters";
assertMatch: "node width=5 metre";
assertMatch: "node width=2m";
assertNoMatch: "node width=2 m";
assertNoMatch: "node width=5";
}
*[width][width =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set width_foot_autofix;
fixAdd: concat("width=", get(regexp_match("([0-9.]+)( )*(.+)",tag("width")),1)," ft");
assertMatch: "node width=6.78 foot";
assertMatch: "node width=5 Feet";
assertMatch: "node width=2ft";
assertNoMatch: "node width=2 ft";
assertNoMatch: "node width=5";
}
*[width][width =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("width=", replace(tag("width"), ",", "."));
set width_separator_autofix;
assertMatch: "node width=5,5";
assertMatch: "node width=12,00";
assertNoMatch: "node width=12,000";
assertNoMatch: "node width=3,50,5";
assertNoMatch: "node width=3.5";
assertNoMatch: "node width=4";
}
*[maxwidth][maxwidth=~ /^[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set maxwidth_meter_autofix;
fixAdd: concat("maxwidth=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxwidth")),1)," m");
assertMatch: "node maxwidth=6.78 meters";
assertMatch: "node maxwidth=5 metre";
assertMatch: "node maxwidth=2m";
assertNoMatch: "node maxwidth=2 m";
assertNoMatch: "node maxwidth=5";
}
*[maxwidth][maxwidth =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/] {
throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
set maxwidth_foot_autofix;
fixAdd: concat("maxwidth=", get(regexp_match("([0-9.]+)( )*(.+)",tag("maxwidth")),1)," ft");
assertMatch: "node maxwidth=6.78 foot";
assertMatch: "node maxwidth=5 Feet";
assertMatch: "node maxwidth=2ft";
assertNoMatch: "node maxwidth=2 ft";
assertNoMatch: "node maxwidth=5";
}
*[maxwidth][maxwidth =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("maxwidth=", replace(tag("maxwidth"), ",", "."));
set maxwidth_separator_autofix;
assertMatch: "node maxwidth=5,5";
assertMatch: "node maxwidth=12,00";
assertNoMatch: "node maxwidth=12,000";
assertNoMatch: "node maxwidth=3,50,5";
assertNoMatch: "node maxwidth=3.5";
assertNoMatch: "node maxwidth=4";
}
*[height ][height !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.height_separator_autofix!.height_meter_autofix!.height_foot_autofix,
*[maxheight][maxheight !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?)|none|default|below_default)$/]!.maxheight_separator_autofix!.maxheight_meter_autofix!.maxheight_foot_autofix,
*[maxlength][maxlength !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?)|none|default|below_default)$/]!.maxlength_separator_autofix!.maxlength_meter_autofix!.maxlength_foot_autofix,
*[width ][width !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([0-9]+\'([0-9]+(\.[0-9]+)?\")?))$/]!.width_separator_autofix!.width_meter_autofix!.width_foot_autofix,
*[maxwidth ][maxwidth !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([0-9]+\'([0-9]+(\.[0-9]+)?\")?))$/]!.maxwidth_separator_autofix!.maxwidth_meter_autofix!.maxwidth_foot_autofix {
throwWarning: tr("unusual value of {0}: meters is default; point is decimal separator; if units, put space then unit", "{0.key}");
assertMatch: "node height=medium";
assertMatch: "node maxheight=-5";
assertMatch: "node maxlength=0";
assertMatch: "node maxlength=10'13\"";
assertMatch: "node width=10'2.\"";
assertMatch: "node maxheight=\"2. m\"";
assertMatch: "node height=\"12. m\"";
assertNoMatch: "node height=6.78 meters";
assertNoMatch: "node height=5 metre";
assertNoMatch: "node height=2m";
assertNoMatch: "node height=3";
assertNoMatch: "node height=2.22 m";
assertNoMatch: "node height=7.8";
assertNoMatch: "node maxwidth=7 ft";
assertNoMatch: "node height=22'";
assertNoMatch: "node width=10'5\"";
assertNoMatch: "node width=10'";
}
*[maxaxleload][maxaxleload =~ /^[0-9]+,[0-9][0-9]?( (t|kg|st|lbs))?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("maxaxleload=", replace(tag("maxaxleload"), ",", "."));
set maxaxleload_separator_autofix;
assertMatch: "node maxaxleload=5,5";
assertMatch: "node maxaxleload=12,00";
assertNoMatch: "node maxaxleload=12,000";
assertNoMatch: "node maxaxleload=3,50,5";
assertNoMatch: "node maxaxleload=3.5";
assertNoMatch: "node maxaxleload=4";
}
*[maxweight][maxweight =~ /^[0-9]+,[0-9][0-9]?( (t|kg|st|lbs))?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("maxweight=", replace(tag("maxweight"), ",", "."));
set maxweight_separator_autofix;
assertMatch: "node maxweight=5,5";
assertMatch: "node maxweight=12,00";
assertNoMatch: "node maxweight=12,000";
assertNoMatch: "node maxweight=3,50,5";
assertNoMatch: "node maxweight=3.5";
assertNoMatch: "node maxweight=4";
}
*[maxaxleload][maxaxleload !~ /^([0-9]+(\.[0-9]+)?( (t|kg|st|lbs))?)$/]!.maxaxleload_separator_autofix,
*[maxweight][maxweight !~ /^([0-9]+(\.[0-9]+)?( (t|kg|st|lbs))?)$/]!.maxweight_separator_autofix {
throwWarning: tr("unusual value of {0}: tonne is default; point is decimal separator; if units, put space then unit", "{0.key}");
assertMatch: "node maxaxleload=something";
assertMatch: "node maxweight=-5";
assertNoMatch: "node maxaxleload=2";
assertNoMatch: "node maxaxleload=2.5";
assertNoMatch: "node maxaxleload=7 kg";
}
way[maxspeed][maxspeed !~ /^(signals|none|unposted|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/],
way[maxspeed:forward][maxspeed:forward !~ /^(signals|none|unposted|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/],
way[maxspeed:backward][maxspeed:backward !~ /^(signals|none|unposted|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/] {
throwWarning: tr("unusual value of {0}", "{0.key}");
assertMatch: "way maxspeed=something";
assertMatch: "way maxspeed=-50";
assertMatch: "way maxspeed=0";
assertNoMatch: "way maxspeed=50";
assertNoMatch: "way maxspeed=30 mph";
assertNoMatch: "way maxspeed=RO:urban";
assertNoMatch: "way maxspeed=RU:rural";
assertNoMatch: "way maxspeed=RU:living_street";
assertNoMatch: "way maxspeed=DE:motorway";
assertNoMatch: "way maxspeed=signals";
assertNoMatch: "way maxspeed=none";
assertNoMatch: "way maxspeed=variable";
}
*[distance][distance =~ /^[0-9]+,[0-9][0-9]?( (m|km|mi|nmi))?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("distance=", replace(tag("distance"), ",", "."));
set distance_separator_autofix;
assertMatch: "node distance=5,5";
assertMatch: "node distance=12,00";
assertNoMatch: "node distance=12,000";
assertNoMatch: "node distance=3,50,5";
assertNoMatch: "node distance=3.5";
assertNoMatch: "node distance=4";
}
*[distance][distance !~ /^(([0-9]+(\.[0-9]+)?( (m|km|mi|nmi))?)|([0-9]+\'([0-9]+(\.[0-9]+)?\")?))$/]!.distance_separator_autofix {
throwWarning: tr("unusual value of {0}: kilometers is default; point is decimal separator; if units, put space then unit", "{0.key}");
assertMatch: "way distance=something";
assertMatch: "way distance=-5";
assertMatch: "way distance=5.";
assertNoMatch: "way distance=2";
assertNoMatch: "way distance=2.5";
assertNoMatch: "way distance=7 mi";
}
way[voltage][voltage =~ /(.*[A-Za-z].*)|.*,.*|.*( ).*/] {
throwWarning: tr("voltage should be in volts with no units/delimiter/spaces");
assertMatch: "way voltage=medium";
assertNoMatch: "way voltage=15000";
}
/* some users are using frequency for other purposes (not electromagnetic)
with the values 'perennial' and 'intermittent'; the vast majority are 0, 16.7, 50 and 60 */
way[frequency][frequency !~ /^(0|[1-9][0-9]*(\.[0-9]+)?)( (kHz|MHz|GHz|THz))?$/] {
throwWarning: tr("unusual value of {0}", "{0.key}");
assertMatch: "way frequency=something";
assertNoMatch: "way frequency=0"; /* DC */
assertNoMatch: "way frequency=16.7";
assertNoMatch: "way frequency=50";
assertNoMatch: "way frequency=680 kHz";
assertNoMatch: "way frequency=123.5 MHz";
}
way[gauge][gauge !~ /^([1-9][0-9]{1,3}(;[1-9][0-9]{1,3})*|broad|standard|narrow)$/] {
throwWarning: tr("unusual value of {0}", "{0.key}");
assertMatch: "way gauge=something";
assertNoMatch: "way gauge=1435";
assertNoMatch: "way gauge=1000;1435";
assertNoMatch: "way gauge=standard";
assertNoMatch: "way gauge=narrow";
}
/* the numbers for percentage and degrees include could probably be bracketed a bit more precisely */
way[incline][incline !~ /^(up|down|-?([0-9]+?(\.[1-9]%)?|100)[%°]?)$/] {
throwWarning: tr("unusual value of {0}", "{0.key}");
suggestAlternative: "x%";
suggestAlternative: "x°";
suggestAlternative: "up";
suggestAlternative: "down";
assertMatch: "way incline=extreme";
assertNoMatch: "way incline=up";
assertNoMatch: "way incline=down";
assertNoMatch: "way incline=10%";
assertNoMatch: "way incline=-5%";
assertNoMatch: "way incline=10°";
}
/* see ticket #9631 */
*[population][population !~ /^[0-9]+$/ ] {
throwWarning: tr("{0} must be a numeric value", "{0.key}");
}
/* must be an integer positive number only and not 0, see #10837 (lanes), #11055 (screen) */
node[seats][seats !~ /^[1-9]([0-9]*)$/][amenity=bench],
way[seats][seats !~ /^[1-9]([0-9]*)$/][amenity=bench],
way[lanes][lanes !~ /^[1-9]([0-9]*)$/][highway],
way["lanes:backward"]["lanes:backward" !~ /^[1-9]([0-9]*)$/][highway],
way["lanes:forward"]["lanes:forward" !~ /^[1-9]([0-9]*)$/][highway],
*[screen][screen !~ /^[1-9]([0-9]*)$/][amenity=cinema] {
throwError: tr("{0} must be a positive integer number", "{0.key}");
assertMatch: "way highway=residential lanes=-1";
assertMatch: "way highway=residential lanes=5.5";
assertMatch: "way highway=residential lanes=1;2";
assertMatch: "way highway=residential lanes:forward=-1";
assertMatch: "way highway=residential lanes:backward=-1";
assertNoMatch: "way highway=residential lanes=1";
assertMatch: "node amenity=cinema screen=led";
assertNoMatch: "node amenity=cinema screen=8";
}
*[admin_level][admin_level !~ /^(1|2|3|4|5|6|7|8|9|10|11|12)$/] {
throwWarning: tr("unusual value of {0}", "{0.key}");
assertMatch: "node admin_level=0";
assertMatch: "node admin_level=-1";
assertMatch: "node admin_level=13";
assertNoMatch: "node admin_level=5";
}
/* #14989 */
*[direction][direction<0],
*[direction][direction>=360],
*[direction][direction !~ /^([0-9][0-9]?[0-9]?|north|east|south|west|N|E|S|W|NE|SE|SW|NW|NNE|ENE|ESE|SSE|SSW|WSW|WNW|NNW|forward|backward|both|clockwise|anti-clockwise|anticlockwise|up|down)((-|;)([0-9][0-9]?[0-9]?|N|E|S|W|NE|SE|SW|NW|NNE|ENE|ESE|SSE|SSW|WSW|WNW|NNW))*$/] {
throwWarning: tr("unusual value of {0}", "{0.key}");
assertMatch: "node direction=north-down";
assertMatch: "node direction=rome";
assertMatch: "node direction=C";
assertMatch: "node direction=NNNE";
assertMatch: "node direction=1360";
assertNoMatch: "node direction=NE-S"; /* ranges are used at tourism=viewpoint*/
assertMatch: "node direction=north-south"; /* ranges only in numbers or short NESW form */
assertMatch: "node direction=north-east"; /* if range use N-E, if single direcion use NE */
assertNoMatch: "node direction=0-360"; /* complete panorama view */
assertNoMatch: "node direction=45-100;190-250;300-360";
assertMatch: "node direction=45-100;190-250;300-";
assertNoMatch: "node direction=45-100;190-250;300";
assertNoMatch: "node direction=90;270";
assertNoMatch: "node direction=up";
assertNoMatch: "node direction=down"; /* up/down are replaced by incline tag, has separate warning */
assertMatch: "node direction=-10";
assertNoMatch: "node direction=0";
assertNoMatch: "node direction=45";
assertMatch: "node direction=360";
assertNoMatch: "node direction=N";
assertNoMatch: "node direction=NNE";
assertNoMatch: "node direction=west";
assertNoMatch: "node direction=forward";
assertNoMatch: "node direction=anti-clockwise";
assertNoMatch: "node direction=anticlockwise"; /* both spellings are in use and even wiki uses both */
}
/* #14786 (should be safe to just remove the meters unit from the value) */
*[ele][ele =~ /^-?[0-9]+(\.[0-9]+)? ?m$/] {
throwWarning: tr("{0} must be a numeric value, in meters and without units", "{0.key}");
fixAdd: concat("ele=", trim(replace(tag("ele"), "m", "")));
set ele_meter_remove_autofix;
assertMatch: "node ele=12m";
assertMatch: "node ele=12 m";
assertNoMatch: "node ele=12km";
assertMatch: "node ele=12.1m";
assertMatch: "node ele=-12.1 m";
assertNoMatch: "node ele=12";
assertNoMatch: "node ele=high";
}
*[ele][ele =~ /^[0-9]+,[0-9][0-9]?$/] {
throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
fixAdd: concat("ele=", replace(tag("ele"), ",", "."));
set ele_separator_autofix;
assertMatch: "node ele=5,5";
assertMatch: "node ele=12,00";
assertNoMatch: "node ele=8,848"; /* wrongly used thousands separator */
assertNoMatch: "node ele=3,50,5";
assertNoMatch: "node ele=3.5";
assertNoMatch: "node ele=4";
}
*[ele][ele !~ /^-?[0-9]+(\.[0-9]+)?$/]!.ele_meter_remove_autofix!.ele_separator_autofix {
throwWarning: tr("{0} must be a numeric value, in meters and without units", "{0.key}");
assertNoMatch: "node ele=12m";
assertNoMatch: "node ele=12 m";
assertMatch: "node ele=12km";
assertNoMatch: "node ele=12.1m";
assertNoMatch: "node ele=-12.1 m";
assertNoMatch: "node ele=12";
assertMatch: "node ele=high";
}
/* #17530 */
*[ele][ele =~ /^-?[0-9]+\.[0-9][0-9][0-9]+$/] {
throwWarning: tr("{0}", "{0.tag}");
group: tr("Unnecessary amount of decimal places");
fixAdd: concat("ele=", round(tag("ele")*100)/100);
assertNoMatch: "node ele=12";
assertNoMatch: "node ele=1.12";
assertMatch: "node ele=12.123";
assertMatch: "node ele=12.1234";
assertMatch: "node ele=-12.6789";
assertNoMatch: "node ele=12.123 m";
assertNoMatch: "node ele=high";
}
/* #15774 */
node[fire_hydrant:pressure="#"] {
throwError: tr("unusual value of {0}", "{0.key}");
}
*[interval][interval !~ /^([0-9][0-9]?|[0-9][0-9]:[0-5][0-9](:[0-9][0-9])?)$/] {
throwWarning: tr("unusual value of {0}", "{0.key}");
assertNoMatch: "way interval=5";
assertNoMatch: "way interval=20";
assertNoMatch: "way interval=00:05";
assertNoMatch: "way interval=00:05:00";
assertNoMatch: "way interval=03:00:00";
assertMatch: "way interval=123";
assertMatch: "way interval=0:5:0";
assertMatch: "way interval=00:65:00";
}
/* #15107 */
*[aeroway=helipad ][iata][iata!~/^[A-Z]{3}$/],
*[aeroway=aerodrome][iata][iata!~/^[A-Z]{3}$/] {
throwWarning: tr("wrong value: {0}", "{1.tag}");
group: tr("Airport tagging");
assertNoMatch: "way aeroway=aerodrome iata=BER";
assertMatch: "way aeroway=aerodrome iata=BERL";
assertMatch: "way aeroway=aerodrome iata=BE";
assertMatch: "way aeroway=aerodrome iata=ber";
}
*[aeroway=helipad ][icao][icao!~/^[A-Z]{4}$/],
*[aeroway=aerodrome][icao][icao!~/^[A-Z]{4}$/] {
throwWarning: tr("wrong value: {0}", "{1.tag}");
group: tr("Airport tagging");
assertNoMatch: "way aeroway=aerodrome icao=EDDB";
assertMatch: "way aeroway=aerodrome icao=EDDBA";
assertMatch: "way aeroway=aerodrome icao=EDD";
assertMatch: "way aeroway=aerodrome icao=eddb";
}
*[aeroway=helipad ][icao][icao!~/^(AG|AN|AY|BG|BI|BK|C|DA|DB|DF|DG|DI|DN|DR|DT|DX|EB|ED|EE|EF|EG|EH|EI|EK|EL|EN|EP|ES|ET|EV|EY|FA|FB|FC|FD|FE|FG|FH|FI|FJ|FK|FL|FM|FN|FO|FP|FQ|FS|FT|FV|FW|FX|FY|FZ|GA|GB|GC|GE|GF|GG|GL|GM|GO|GQ|GS|GU|GV|HA|HB|HC|HD|HE|HH|HK|HL|HR|HS|HT|HU|K|LA|LB|LC|LD|LE|LF|LG|LH|LI|LJ|LK|LL|LM|LN|LO|LP|LQ|LR|LS|LT|LU|LV|LW|LX|LY|LZ|MB|MD|MG|MH|MK|MM|MN|MP|MR|MS|MT|MU|MW|MY|MZ|NC|NF|NG|NI|NL|NS|NT|NV|NW|NZ|OA|OB|OE|OI|OJ|OK|OL|OM|OO|OP|OR|OS|OT|OY|PA|PB|PC|PF|PG|PH|PJ|PK|PL|PM|PO|PP|PT|PW|RC|RJ|RK|RO|RP|SA|SB|SC|SD|SE|SF|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SP|SS|SU|SV|SW|SY|TA|TB|TD|TF|TG|TI|TJ|TK|TL|TN|TQ|TR|TT|TU|TV|TX|U|UA|UB|UC|UD|UG|UK|UM|UT|VA|VC|VD|VE|VG|VH|VI|VL|VM|VN|VO|VQ|VR|VT|VV|VY|WA|WB|WI|WM|WP|WQ|WR|WS|Y|Z|ZK|ZM)/],
*[aeroway=aerodrome][icao][icao!~/^(AG|AN|AY|BG|BI|BK|C|DA|DB|DF|DG|DI|DN|DR|DT|DX|EB|ED|EE|EF|EG|EH|EI|EK|EL|EN|EP|ES|ET|EV|EY|FA|FB|FC|FD|FE|FG|FH|FI|FJ|FK|FL|FM|FN|FO|FP|FQ|FS|FT|FV|FW|FX|FY|FZ|GA|GB|GC|GE|GF|GG|GL|GM|GO|GQ|GS|GU|GV|HA|HB|HC|HD|HE|HH|HK|HL|HR|HS|HT|HU|K|LA|LB|LC|LD|LE|LF|LG|LH|LI|LJ|LK|LL|LM|LN|LO|LP|LQ|LR|LS|LT|LU|LV|LW|LX|LY|LZ|MB|MD|MG|MH|MK|MM|MN|MP|MR|MS|MT|MU|MW|MY|MZ|NC|NF|NG|NI|NL|NS|NT|NV|NW|NZ|OA|OB|OE|OI|OJ|OK|OL|OM|OO|OP|OR|OS|OT|OY|PA|PB|PC|PF|PG|PH|PJ|PK|PL|PM|PO|PP|PT|PW|RC|RJ|RK|RO|RP|SA|SB|SC|SD|SE|SF|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SP|SS|SU|SV|SW|SY|TA|TB|TD|TF|TG|TI|TJ|TK|TL|TN|TQ|TR|TT|TU|TV|TX|U|UA|UB|UC|UD|UG|UK|UM|UT|VA|VC|VD|VE|VG|VH|VI|VL|VM|VN|VO|VQ|VR|VT|VV|VY|WA|WB|WI|WM|WP|WQ|WR|WS|Y|Z|ZK|ZM)/] {
throwWarning: tr("wrong value: {0}", "{1.tag}");
group: tr("Airport tagging");
assertNoMatch: "way aeroway=aerodrome icao=EDDB";
assertMatch: "way aeroway=aerodrome icao=EQQQ";
}
/* #18573 */
*[isced:level][isced:level !~ /^(0|1|2|3|4|5|6|7|8)((;|-)(1|2|3|4|5|6|7|8))*$/] {
throwWarning: tr("unusual value of {0}", "{0.key}");
assertMatch: "node isced:level=secondary";
assertMatch: "node isced:level=0,1,2,3";
assertMatch: "node isced:level=9";
assertMatch: "node isced:level=10";
assertNoMatch: "node isced:level=0;1;2;3";
assertNoMatch: "node isced:level=0";
assertNoMatch: "node isced:level=5";
assertNoMatch: "node isced:level=0-3";
}
/* #11253, maxstay=0 is unclear. Was in presets. */
*[maxstay=0] {
throwWarning: tr("Definition of {0} is unclear", "{0.tag}");
assertMatch: "node maxstay=0";
assertMatch: "way maxstay=0";
assertNoMatch: "node maxstay=2";
assertNoMatch: "way maxstay=no";
}
/* #11253, maxstay needs unit. Was in presets without it. Autofixes for the most common cases. */
*[maxstay][maxstay =~ /^([1-9][0-9]*(\.[0-9]+)? min)$/][maxstay!="1 min"] {
throwWarning: tr("unusual value of {0}: set unit e.g. {1} or {2}; only positive values; point is decimal separator; space between value and unit", "{0.key}", "minutes", "hours");
fixAdd: concat("maxstay=", replace(tag("maxstay"), "min", "minutes"));
set maxstay_autofix;
assertMatch: "node maxstay=\"5 min\"";
assertMatch: "node maxstay=\"15 min\"";
assertNoMatch: "node maxstay=\"1 min\"";
assertNoMatch: "node maxstay=\"02 minutes\"";
assertNoMatch: "node maxstay=\"2 minutes\"";
}
*[maxstay="1h"],
*[maxstay="1 h"],
*[maxstay="1 hr"] {
throwWarning: tr("unusual value of {0}: set unit e.g. {1} or {2}; only positive values; point is decimal separator; space between value and unit", "{0.key}", "minutes", "hours");
fixAdd: "maxstay=1 hour";
set maxstay_autofix;
assertMatch: "node maxstay=1h";
assertMatch: "node maxstay=\"1 h\"";
assertMatch: "node maxstay=\"1 hr\"";
}
*[maxstay][maxstay =~ /^([1-9][0-9]*(\.[0-9]+)? h)$/][maxstay!="1 h"] {
throwWarning: tr("unusual value of {0}: set unit e.g. {1} or {2}; only positive values; point is decimal separator; space between value and unit", "{0.key}", "minutes", "hours");
fixAdd: concat("maxstay=", replace(tag("maxstay"), "h", "hours"));
set maxstay_autofix;
assertMatch: "node maxstay=\"5 h\"";
assertMatch: "node maxstay=\"15 h\"";
assertNoMatch: "node maxstay=\"1 h\"";
assertNoMatch: "node maxstay=\"02 hours\"";
assertNoMatch: "node maxstay=\"2 hours\"";
}
*[maxstay][maxstay =~ /^([1-9][0-9]*(\.[0-9]+)? hr)$/][maxstay!="1 hr"] {
throwWarning: tr("unusual value of {0}: set unit e.g. {1} or {2}; only positive values; point is decimal separator; space between value and unit", "{0.key}", "minutes", "hours");
fixAdd: concat("maxstay=", replace(tag("maxstay"), "hr", "hours"));
set maxstay_autofix;
assertMatch: "node maxstay=\"5 hr\"";
assertMatch: "node maxstay=\"15 hr\"";
assertNoMatch: "node maxstay=\"1 hr\"";
assertNoMatch: "node maxstay=\"02 hours\"";
assertNoMatch: "node maxstay=\"2 hours\"";
}
*[maxstay][maxstay =~ /^([1-9][0-9]*(\.[0-9]+)?h)$/][maxstay!="1h"] {
throwWarning: tr("unusual value of {0}: set unit e.g. {1} or {2}; only positive values; point is decimal separator; space between value and unit", "{0.key}", "minutes", "hours");
fixAdd: concat("maxstay=", replace(tag("maxstay"), "h", " hours"));
set maxstay_autofix;
assertMatch: "node maxstay=5h";
assertMatch: "node maxstay=15h";
assertNoMatch: "node maxstay=1h";
assertNoMatch: "node maxstay=02hours";
assertNoMatch: "node maxstay=2hours";
assertNoMatch: "node maxstay=\"2 h\"";
assertNoMatch: "node maxstay=\"2 hr\"";
}
/* the rest without autofix */
*[maxstay][maxstay !~ /^(([1-9][0-9]*(\.[0-9]+)?( (minute|minutes|hour|hours|day|days|week|weeks|month|months|year|years)))|(no|unlimited|0|load-unload))$/]!.maxstay_autofix {
throwWarning: tr("unusual value of {0}: set unit e.g. {1} or {2}; only positive values; point is decimal separator; space between value and unit", "{0.key}", "minutes", "hours");
assertMatch: "node maxstay=something";
assertMatch: "node maxstay=-5";
assertMatch: "node maxstay=180";
assertMatch: "node maxstay=66minutes";
assertMatch: "node maxstay=\"1. hours\"";
assertMatch: "node maxstay=\"0 minutes\"";
assertNoMatch: "node maxstay=0";
assertNoMatch: "node maxstay=no";
assertNoMatch: "node maxstay=\"7 h\"";
assertNoMatch: "node maxstay=\"7 hr\"";
assertNoMatch: "node maxstay=unlimited";
assertNoMatch: "node maxstay=load-unload";
assertNoMatch: "node maxstay=\"66 minutes\"";
assertNoMatch: "node maxstay=\"2.5 hours\"";
}
/* #19536 */
*[name][name =~ /^([0-9.,]+)$/] {
throwOther: tr("Numeric name: {0}. Maybe {1} or {2} is meant.", "{0.value}", "ref", "addr:housenumber");
assertMatch: "node name=12";
assertMatch: "node name=3.5";
assertNoMatch: "node name=\"1. Chemnitzer Billardclub 1952 e.V.\"";
}
|