| | 1 | = Extended runway validator rules = |
| | 2 | |
| | 3 | See JOSM #22822 - runway heading validator |
| | 4 | |
| | 5 | The ref=* values should follow the general rule: |
| | 6 | `[digit:1-3][designator]/[digit:1-3][designator]` |
| | 7 | |
| | 8 | Mentioned/described in: |
| | 9 | - https://www.faa.gov/documentLibrary/media/Advisory_Circular/AMR_Data_Dictionary_2022_10_14.pdf |
| | 10 | - https://www.faa.gov/documentLibrary/media/advisory_circular/150-5200-35/150_5200_35.pdf |
| | 11 | - https://aviation.stackexchange.com/questions/71863/why-is-it-runway-1-instead-of-01-in-america |
| | 12 | |
| | 13 | Possible designators are: |
| | 14 | - L left |
| | 15 | - C center |
| | 16 | - R right |
| | 17 | |
| | 18 | - W water sealane or waterway |
| | 19 | - S STOL runway |
| | 20 | - G glider runway |
| | 21 | - U ultralight runway |
| | 22 | |
| | 23 | |
| | 24 | {{{ |
| | 25 | #!rule |
| | 26 | |
| | 27 | meta { |
| | 28 | title: "Extended runway rules"; |
| | 29 | version: "[[revision]]_[[date]]"; |
| | 30 | description: "Extending core runway validation rules. Currently validating ref values and offering autofix for runways drawn as an area."; |
| | 31 | author: "gaben"; |
| | 32 | link: "https://josm.openstreetmap.de/wiki/Rules/Runways"; |
| | 33 | min-josm-version: "11424"; /* due to territory selectors */ |
| | 34 | baselanguage: "en"; |
| | 35 | } |
| | 36 | |
| | 37 | /* raising error only if {first designator >= the second designator} */ |
| | 38 | way[aeroway=runway][ref =~ /^([0-9]{1,3}[LCRWSGU]? ?[-,;\/\\] ?[0-9]{1,3}[LCRWSGU]?)$/][to_int(get(regexp_match("^([0-9]+)[LCRWSGU]? ?[-,;\\/] ?([0-9]+)[LCRWSGU]?$", tag("ref")), 1)) >= to_int(get(regexp_match("^([0-9]+)[LCRWSGU]? ?[-,;\\/] ?([0-9]+)[LCRWSGU]?$", tag("ref")), 2))] { |
| | 39 | group: tr("runway reference"); |
| | 40 | set runwayDesignatorOrderIssue; |
| | 41 | /*assertMatch: "way aeroway=runway ref=02-01"; |
| | 42 | assertMatch: "way aeroway=runway ref=\"2- 1\""; |
| | 43 | assertMatch: "way aeroway=runway ref=\"2 - 1\""; |
| | 44 | assertMatch: "way aeroway=runway ref=36/18"; |
| | 45 | assertMatch: "way aeroway=runway ref=36W-17W"; |
| | 46 | assertMatch: "way aeroway=runway ref=01/01";*/ |
| | 47 | /* assertMatch: "way aeroway=runway ref=\"36\18\""; not working, even raises a GUI exception :( */ |
| | 48 | assertNoMatch: "way aeroway=runway ref=17W-36W"; |
| | 49 | assertNoMatch: "way aeroway=runway ref=01- 02"; |
| | 50 | assertNoMatch: "way aeroway=runway ref=03G/12G"; |
| | 51 | assertNoMatch: "way aeroway=runway ref=01-19"; |
| | 52 | assertNoMatch: "way aeroway=runway ref=3/21"; |
| | 53 | assertNoMatch: "way aeroway=runway ref=09L/27R"; |
| | 54 | } |
| | 55 | |
| | 56 | /* raising error only if {second designator - first designator != 18} [global version] */ |
| | 57 | way[aeroway=runway][ref =~ /^([0-9]{1,2}[LCRWSGU]? ?[-,;\/\\] ?[0-9]{1,2}[LCRWSGU]?)$/][to_int(get(regexp_match("^([0-9]+)[LCRWSGU]? ?[-,;\\/] ?([0-9]+)[LCRWSGU]?$", tag("ref")), 2)) - to_int(get(regexp_match("^([0-9]+)[LCRWSGU]? ?[-,;\\/] ?([0-9]+)[LCRWSGU]?$", tag("ref")), 1)) != 18]!.runwayDesignatorOrderIssue { |
| | 58 | group: tr("runway reference"); |
| | 59 | set global180RuleIssue; |
| | 60 | throwError: tr("numbers not following the 180 degree rule (global version)"); |
| | 61 | assertMatch: "way aeroway=runway ref=\"01 -02R\""; |
| | 62 | assertMatch: "way aeroway=runway ref=17W-36W"; |
| | 63 | assertMatch: "way aeroway=runway ref=\"01/ 02\""; |
| | 64 | assertMatch: "way aeroway=runway ref=03G/12G"; |
| | 65 | assertNoMatch: "way aeroway=runway ref=01-19"; |
| | 66 | assertNoMatch: "way aeroway=runway ref=\"3 / 21\""; |
| | 67 | assertNoMatch: "way aeroway=runway ref=09L/27R"; |
| | 68 | } |
| | 69 | |
| | 70 | /* raising error only if {second designator - first designator != 180} [American version] */ |
| | 71 | way[aeroway=runway][ref =~ /^([0-9]{1,3}[LCRWSGU]? ?[-,;\/\\] ?[0-9]{3}[LCRWSGU]?)$/][to_int(get(regexp_match("^([0-9]+)[LCRWSGU]? ?[-,;\\/] ?([0-9]+)[LCRWSGU]?$", tag("ref")), 2)) - to_int(get(regexp_match("^([0-9]+)[LCRWSGU]? ?[-,;\\/] ?([0-9]+)[LCRWSGU]?$", tag("ref")), 1)) != 180]!.runwayDesignatorOrderIssue { |
| | 72 | group: tr("runway reference"); |
| | 73 | set american180RuleIssue; |
| | 74 | throwError: tr("numbers not following the 180 degree rule (American version)"); |
| | 75 | assertMatch: "way aeroway=runway ref=170W-360W"; |
| | 76 | assertMatch: "way aeroway=runway ref=\"10/ 100\""; |
| | 77 | assertMatch: "way aeroway=runway ref=30G/120G"; |
| | 78 | assertNoMatch: "way aeroway=runway ref=10-190"; |
| | 79 | assertNoMatch: "way aeroway=runway ref=\"30 / 210\""; |
| | 80 | assertNoMatch: "way aeroway=runway ref=09L/27R"; |
| | 81 | } |
| | 82 | |
| | 83 | /* offer heading separator fix */ |
| | 84 | way[aeroway=runway][ref =~ /^([0-9]{1,3}[LCRWSGU]? [-,;\/\\][0-9]{1,3}[LCRWSGU]?)$/]!.runwayDesignatorOrderIssue!.global180RuleIssue!.american180RuleIssue, |
| | 85 | way[aeroway=runway][ref =~ /^([0-9]{1,3}[LCRWSGU]?[-,;\/\\] [0-9]{1,3}[LCRWSGU]?)$/]!.runwayDesignatorOrderIssue!.global180RuleIssue!.american180RuleIssue, |
| | 86 | way[aeroway=runway][ref =~ /^([0-9]{1,3}[LCRWSGU]? [-,;\/\\] [0-9]{1,3}[LCRWSGU]?)$/]!.runwayDesignatorOrderIssue!.global180RuleIssue!.american180RuleIssue { |
| | 87 | group: tr("runway reference"); |
| | 88 | assertMatch: "way aeroway=runway ref=\"09L /27R\""; |
| | 89 | assertMatch: "way aeroway=runway ref=\"09L/ 27R\""; |
| | 90 | assertNoMatch: "way aeroway=runway ref=09L/27R"; |
| | 91 | throwWarning: tr("values can be prettified, separator"); |
| | 92 | fixAdd: concat("ref=", eval(get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1) > get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2)) ? get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2) : get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1) , "/", |
| | 93 | eval(get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1) > get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2)) ? get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1) : get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2)); |
| | 94 | } |
| | 95 | |
| | 96 | /* offer heading order fix */ |
| | 97 | way[aeroway=runway].runwayDesignatorOrderIssue!.global180RuleIssue!.american180RuleIssue { |
| | 98 | group: tr("runway reference"); |
| | 99 | throwError: tr("designators should be in increasing order"); |
| | 100 | fixAdd: concat("ref=", eval(get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1) > get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2)) ? get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2) : get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1) , "/", |
| | 101 | eval(get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1) > get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2)) ? get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1) : get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2)); |
| | 102 | } |
| | 103 | |
| | 104 | /* offer heading leading zero fix (except USA, Mexico) */ |
| | 105 | way[aeroway=runway][outside("US,MX")][ref =~ /^([0-9]{1}[LCRWSGU]? ?[-,;\/\\] ?[0-9]{1,3}[LCRWSGU]?)$/]!.runwayDesignatorOrderIssue!.global180RuleIssue!.american180RuleIssue { |
| | 106 | group: tr("runway reference"); |
| | 107 | assertMatch: "way aeroway=runway ref=9L/27R"; |
| | 108 | assertNoMatch: "way aeroway=runway ref=09L/27R"; |
| | 109 | throwWarning: tr("values can be prettified, leading zero"); |
| | 110 | fixAdd: concat("ref=0", get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 1), "/", get(regexp_match("^([0-9]+[LCRWSGU]?) ?[-,;\\/] ?([0-9]+[LCRWSGU]?)$", tag("ref")), 2)); |
| | 111 | } |
| | 112 | |
| | 113 | /*** |
| | 114 | NOW SOMETHING DIFFERENT - restrict runways to unclosed ways and offer autofix to area:aeroway. See https://wiki.openstreetmap.org/wiki/Tag:aeroway%3Drunway#How_to_map |
| | 115 | */ |
| | 116 | way:closed[aeroway=runway] { |
| | 117 | throwWarning: tr("{0} on a closed way. Should be used on an unclosed way.", "{1.tag}"); |
| | 118 | suggestAlternative: "area:aeroway=runway"; |
| | 119 | fixAdd: "area:aeroway=runway"; |
| | 120 | fixRemove: "aeroway"; |
| | 121 | fixRemove: "area"; |
| | 122 | } |
| | 123 | |
| | 124 | }}} |