| | 1 | Rules to validate address tags as defined by Czech Republic Address System: http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system. This system is exclusively used in Czech Republic and Slovakia. |
| | 2 | |
| | 3 | {{{ |
| | 4 | /* implementation of Czech Republic Address System for JOSM validator as per http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system |
| | 5 | Only makes sense to edits within borders of Czech and Slovak republic. |
| | 6 | |
| | 7 | Not all but majority of cases should be covered by this. |
| | 8 | |
| | 9 | Sada pravidiel pre JOSM validator implementujuca kontrolu tagov zadavanych podla unikatneho systemu cislovania budov pre Cesku a Slovensku republiku (http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system). |
| | 10 | |
| | 11 | Pozn. |
| | 12 | - evidencne cisla sa prideluju len budovam na uzemi CR |
| | 13 | - orientacne cisla na Slovensku obsahujuce pismeno sa pisu velkym pismenom, napr. 12A, 3B, 8C |
| | 14 | |
| | 15 | |
| | 16 | please send fixes and suggestions to: jose1711 gmail com |
| | 17 | */ |
| | 18 | |
| | 19 | /* streetnumber syntax check |
| | 20 | orientacne cislo musi vyhovovat reg. vyrazu popisanemu na wiki: http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system |
| | 21 | */ |
| | 22 | *[addr:streetnumber][addr:streetnumber !~ /^[1-9]+[0-9]*[A-Za-z]{0,1}$/]{ |
| | 23 | throwError: tr("Format of streetnumber not recognized - expected a number followed by an optional single letter"); |
| | 24 | } |
| | 25 | |
| | 26 | /* conscriptionnumber syntax check |
| | 27 | supisne cislo musi vyhovovat reg. vyrazu popisanemu na wiki: http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system |
| | 28 | */ |
| | 29 | *[addr:conscriptionnumber][addr:conscriptionnumber !~ /^[1-9]+[0-9]*$/]{ |
| | 30 | throwError: tr("Format of {0} not recognized - expected a natural number", "{0.key}"); |
| | 31 | } |
| | 32 | |
| | 33 | /* provisionalnumber syntax check |
| | 34 | evidencne cislo musi vyhovovat reg. vyrazu popisanemu na wiki: http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system |
| | 35 | */ |
| | 36 | *[addr:provisionalnumber][addr:provisionalnumber !~ /^[1-9]+[0-9]*$/]{ |
| | 37 | throwError: tr("Format of {0} not recognized - expected a natural number", "{0.key}"); |
| | 38 | } |
| | 39 | |
| | 40 | /* each address should have at least addr:street or addr:place |
| | 41 | kazda adresa by mala obsahovat bud addr:street alebo addr:place, pripadne oboje |
| | 42 | */ |
| | 43 | *[any(tag("addr:streetnumber"),tag("addr:conscriptionnumber"),tag("addr:housenumber"))][!addr:street][!addr:place] { |
| | 44 | throwWarning: tr("Each address should have at least addr:street or addr:place tag"); |
| | 45 | } |
| | 46 | |
| | 47 | |
| | 48 | /* conscriptionnumber and provisionalnumber are mutualy exclusive |
| | 49 | ziaden dom by nemal mat sucasne supisne a evidencne cislo |
| | 50 | */ |
| | 51 | *[addr:conscriptionnumber][addr:provisionalnumber]{ |
| | 52 | throwError: tr("There should be either addr:conscriptionnumber or addr:provisionalnumber, not both at the same time"); |
| | 53 | } |
| | 54 | |
| | 55 | /* check for missing street in presence of streetnumber tag |
| | 56 | streetnumber by malo byt pouzite len spolu s orientacnym cislom |
| | 57 | */ |
| | 58 | *[addr:streetnumber][!addr:street]{ |
| | 59 | throwWarning: tr("Addr:streetnumber used without an addr:street tag"); |
| | 60 | } |
| | 61 | |
| | 62 | /* if both streetnumber and conscriptionnumber are present then housenumber should be formatted as conscriptionnumber/streetnumber |
| | 63 | v pripade pouzitia supisneho aj orientacneho cisla by hodnota housenumber mala obsahovat kombinaciu oboch vo forme supisne/orientacne cislo |
| | 64 | */ |
| | 65 | *[addr:housenumber][addr:streetnumber][addr:conscriptionnumber][not(tag("addr:housenumber") = concat(tag("addr:conscriptionnumber"),"/",tag("addr:streetnumber")))]{ |
| | 66 | throwWarning: tr("Addr:housenumber in unexpected format (expected: conscriptionnumber/streetnumber)"); |
| | 67 | fixAdd: concat("addr:housenumber=",tag("addr:conscriptionnumber"),"/",tag("addr:streetnumber")); |
| | 68 | } |
| | 69 | |
| | 70 | /* if both streetnumber and provisionalnumber are present then housenumber should be formatted as "ev."+provisionalnumber/streetnumber |
| | 71 | v pripade pouzitia evidencneho aj orientacneho cisla by hodnota housenumber mala obsahovat kombinaciu oboch vo forme ev.evidencne/orientacne cislo |
| | 72 | */ |
| | 73 | *[addr:housenumber][addr:streetnumber][addr:provisionalnumber][not(tag("addr:housenumber") = concat("ev.",tag("addr:provisionalnumber"),"/",tag("addr:streetnumber")))]{ |
| | 74 | throwWarning: tr("Addr:housenumber in unexpected format (expected: ev.+provisional/streetnumber)"); |
| | 75 | fixAdd: concat("addr:housenumber=ev.",tag("addr:provisionalnumber"),"/",tag("addr:streetnumber")); |
| | 76 | } |
| | 77 | |
| | 78 | /* if both streetnumber and conscriptionnumber are present then housenumber should be formatted as conscriptionnumber/streetnumber |
| | 79 | v pripade pouzitia supisneho aj orientacneho cisla by hodnota housenumber mala obsahovat kombinaciu oboch vo forme supisne/orientacne cislo |
| | 80 | */ |
| | 81 | *[!addr:housenumber][addr:streetnumber][addr:conscriptionnumber]{ |
| | 82 | throwWarning: tr("Addr:housenumber missing - expected: conscriptionnumber/streetnumber"); |
| | 83 | fixAdd: concat("addr:housenumber=",tag("addr:conscriptionnumber"),"/",tag("addr:streetnumber")); |
| | 84 | } |
| | 85 | |
| | 86 | /* if both streetnumber and provisionalnumber are present then housenumber should be formatted as "ev."+provisionalnumber/streetnumber |
| | 87 | v pripade pouzitia evidencneho aj orientacneho cisla by hodnota housenumber mala obsahovat kombinaciu oboch vo forme ev.evidencne/orientacne cislo |
| | 88 | */ |
| | 89 | *[!addr:housenumber][addr:streetnumber][addr:provisionalnumber]{ |
| | 90 | throwWarning: tr("Addr:housenumber missing - expected: ev.+provisionalnumber/streetnumber"); |
| | 91 | fixAdd: concat("addr:housenumber=ev.",tag("addr:provisionalnumber"),"/",tag("addr:streetnumber")); |
| | 92 | } |
| | 93 | |
| | 94 | /* if only conscriptionnumber is present then housenumber should contain its value |
| | 95 | pre dom, ktory je identifikovany len supisnym cislom, by sa toto cislo malo objavit aj v housenumber |
| | 96 | */ |
| | 97 | *[addr:housenumber][!addr:streetnumber][addr:conscriptionnumber][not(tag("addr:housenumber") = tag("addr:conscriptionnumber"))]{ |
| | 98 | throwWarning: tr("{0} should contain addr:conscriptionnumber","{0.key}"); |
| | 99 | fixAdd: concat("addr:housenumber=",tag("addr:conscriptionnumber")); |
| | 100 | } |
| | 101 | |
| | 102 | /* if only provisionalnumber is present then housenumber should contain its value |
| | 103 | pre dom, ktory je identifikovany len evidencnym cislom, by sa toto cislo malo objavit aj v housenumber |
| | 104 | */ |
| | 105 | *[addr:housenumber][!addr:streetnumber][addr:provisionalnumber][not(tag("addr:housenumber") = concat("ev.",tag("addr:provisionalnumber")))]{ |
| | 106 | throwWarning: tr("{0} should contain ev. + addr:provisionalnumber","{0.key}"); |
| | 107 | fixAdd: concat("addr:housenumber=ev.",tag("addr:provisionalnumber")); |
| | 108 | } |
| | 109 | |
| | 110 | /* if housenumber is not empty we want to have conscriptionnumber and/or streetnumber populated as well */ |
| | 111 | *[addr:housenumber][!addr:streetnumber][!addr:conscriptionnumber][addr:housenumber =~ /\/[1-9]+/] { |
| | 112 | throwWarning: tr("Streetnumber and conscriptionnumber missing"); |
| | 113 | } |
| | 114 | |
| | 115 | /* typo checks |
| | 116 | detekcia castych preklepov |
| | 117 | */ |
| | 118 | *[addr:streetnumbe]{ |
| | 119 | throwError: tr("Typo detected with streetnumber"); |
| | 120 | suggestAlternative: "addr:streetnumber"; |
| | 121 | fixChangeKey: "addr:streetnumbe=>addr:streetnumber"; |
| | 122 | } |
| | 123 | |
| | 124 | *[addr:conscriptionumber]{ |
| | 125 | throwError: tr("Typo detected with conscriptionnumber"); |
| | 126 | suggestAlternative: "addr:conscriptionnumber"; |
| | 127 | fixChangeKey: "addr:conscriptionumber=>addr:conscriptionnumber"; |
| | 128 | } |
| | 129 | }}} |