wiki:Rules/CzechRepublicAddressSystem

Rules to validate address tags as defined by Czech Republic Address System: osmwiki:Cs:WikiProject_Czech_Republic/Address_system. This system is exclusively used in Czech Republic and Slovakia.

meta
{
  title: "Czech Republic Address System";
  version: "2.11_2017-02-16";
  description: "Rules implementing checks for address tags specified by Czech Republic Address System. Only used in CZ and SK.";
  author: "Jose Riha";
  link: "http://josm.openstreetmap.de/wiki/Rules/CzechRepublicAddressSystem";
  watch-modified: true;
  min-josm-version: "11424"; /* due to territory selectors */
}

/* implementation of Czech Republic Address System for JOSM validator as per http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system
Only makes sense to edits within borders of Czech and Slovak republic.

Not all but majority of cases should be covered by this.

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).

Pozn.
- evidencne cisla sa prideluju len budovam na uzemi CR
- orientacne cisla na Slovensku obsahujuce pismeno sa pisu velkym pismenom, napr. 12A, 3B, 8C


please send fixes and suggestions to: jose1711 gmail com
*/

/* streetnumber syntax check
orientacne cislo musi vyhovovat reg. vyrazu popisanemu na wiki: http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system
*/
*[addr:streetnumber][addr:streetnumber !~ /^[1-9]+[0-9]*[A-Za-z]{0,1}$/][inside("CZ")]{
throwError: tr("Format of streetnumber not recognized - expected a number followed by an optional single letter");
}

/* streetnumber syntax check
orientacne cislo musi vyhovovat reg. vyrazu popisanemu na wiki: http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system
*/
*[addr:streetnumber][addr:streetnumber !~ /^[1-9]+[0-9]*[A-Z]{0,1}$/][inside("SK")]{
throwError: tr("Format of streetnumber not recognized - expected a number followed by an optional single letter");
}

/* conscriptionnumber syntax check
supisne cislo musi vyhovovat reg. vyrazu popisanemu na wiki: http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system
*/
*[addr:conscriptionnumber][addr:conscriptionnumber !~ /^[1-9]+[0-9]*$/][inside("CZ,SK")]{
throwError: tr("Format of {0} not recognized - expected a natural number", "{0.key}");
}

/* provisionalnumber syntax check
evidencne cislo musi vyhovovat reg. vyrazu popisanemu na wiki: http://wiki.openstreetmap.org/wiki/Cs:WikiProject_Czech_Republic/Address_system
*/
*[addr:provisionalnumber][addr:provisionalnumber !~ /^[1-9]+[0-9]*$/][inside("CZ")]{
throwError: tr("Format of {0} not recognized - expected a natural number", "{0.key}");
}

/* each address should have at least addr:street or addr:place
kazda adresa by mala obsahovat bud addr:street alebo addr:place, pripadne oboje
*/
*[any(tag("addr:streetnumber"),tag("addr:conscriptionnumber"),tag("addr:housenumber"))][!addr:street][!addr:place][inside("CZ,SK")] {
throwWarning: tr("Each address should have at least addr:street or addr:place tag");
}


/* conscriptionnumber and provisionalnumber are mutualy exclusive
ziaden dom by nemal mat sucasne supisne a evidencne cislo
*/
*[addr:conscriptionnumber][addr:provisionalnumber][inside("CZ")]{
throwError: tr("There should be either addr:conscriptionnumber or addr:provisionalnumber, not both at the same time");
}

/* check for missing street in presence of streetnumber tag
streetnumber by malo byt pouzite len spolu s orientacnym cislom
*/
*[addr:streetnumber][!addr:street][inside("CZ,SK")]{
throwWarning: tr("Addr:streetnumber used without an addr:street tag");
}

/* if both streetnumber and conscriptionnumber are present then housenumber should be formatted as conscriptionnumber/streetnumber
v pripade pouzitia supisneho aj orientacneho cisla by hodnota housenumber mala obsahovat kombinaciu oboch vo forme supisne/orientacne cislo
*/
*[addr:housenumber][addr:streetnumber][addr:conscriptionnumber][not(tag("addr:housenumber") = concat(tag("addr:conscriptionnumber"),"/",tag("addr:streetnumber")))][inside("CZ,SK")]{
throwWarning: tr("Addr:housenumber in unexpected format (expected: conscriptionnumber/streetnumber)");
fixAdd: concat("addr:housenumber=",tag("addr:conscriptionnumber"),"/",tag("addr:streetnumber"));
}

/* if both streetnumber and provisionalnumber are present then housenumber should be formatted as "ev."+provisionalnumber/streetnumber
v pripade pouzitia evidencneho aj orientacneho cisla by hodnota housenumber mala obsahovat kombinaciu oboch vo forme ev.evidencne/orientacne cislo
*/
*[addr:housenumber][addr:streetnumber][addr:provisionalnumber][not(tag("addr:housenumber") = concat("ev.",tag("addr:provisionalnumber"),"/",tag("addr:streetnumber")))][inside("CZ")]{
throwWarning: tr("Addr:housenumber in unexpected format (expected: ev.+provisional/streetnumber)");
fixAdd: concat("addr:housenumber=ev.",tag("addr:provisionalnumber"),"/",tag("addr:streetnumber"));
}

/* if both streetnumber and conscriptionnumber are present then housenumber should be formatted as conscriptionnumber/streetnumber
v pripade pouzitia supisneho aj orientacneho cisla by hodnota housenumber mala obsahovat kombinaciu oboch vo forme supisne/orientacne cislo
*/
*[!addr:housenumber][addr:streetnumber][addr:conscriptionnumber][inside("CZ,SK")]{
throwWarning: tr("Addr:housenumber missing - expected: conscriptionnumber/streetnumber");
fixAdd: concat("addr:housenumber=",tag("addr:conscriptionnumber"),"/",tag("addr:streetnumber"));
}

/* if both streetnumber and provisionalnumber are present then housenumber should be formatted as "ev."+provisionalnumber/streetnumber
v pripade pouzitia evidencneho aj orientacneho cisla by hodnota housenumber mala obsahovat kombinaciu oboch vo forme ev.evidencne/orientacne cislo
*/
*[!addr:housenumber][addr:streetnumber][addr:provisionalnumber][inside("CZ")]{
throwWarning: tr("Addr:housenumber missing - expected: ev.+provisionalnumber/streetnumber");
fixAdd: concat("addr:housenumber=ev.",tag("addr:provisionalnumber"),"/",tag("addr:streetnumber"));
}

/* if only conscriptionnumber is present then housenumber should contain its value
pre dom, ktory je identifikovany len supisnym cislom, by sa toto cislo malo objavit aj v housenumber
*/
*[addr:housenumber][!addr:streetnumber][addr:conscriptionnumber][not(tag("addr:housenumber") = tag("addr:conscriptionnumber"))][inside("CZ,SK")]{
throwWarning: tr("{0} should contain addr:conscriptionnumber","{0.key}");
fixAdd: concat("addr:housenumber=",tag("addr:conscriptionnumber"));
}

/* if only provisionalnumber is present then housenumber should contain its value
pre dom, ktory je identifikovany len evidencnym cislom, by sa toto cislo malo objavit aj v housenumber
*/
*[addr:housenumber][!addr:streetnumber][addr:provisionalnumber][not(tag("addr:housenumber") = concat("ev.",tag("addr:provisionalnumber")))][inside("CZ")]{
throwWarning: tr("{0} should contain ev. + addr:provisionalnumber","{0.key}");
fixAdd: concat("addr:housenumber=ev.",tag("addr:provisionalnumber"));
}

/* if housenumber is not empty we want to have conscriptionnumber and/or streetnumber populated as well */
*[addr:housenumber][!addr:streetnumber][!addr:conscriptionnumber][addr:housenumber =~ /\/[1-9]+/][inside("CZ,SK")] {
throwWarning: tr("Streetnumber and conscriptionnumber missing");
fixAdd: concat("addr:conscriptionnumber=",get(split("/",tag("addr:housenumber")),0));
fixAdd: concat("addr:streetnumber=",get(split("/",tag("addr:housenumber")),1));
}

/* typo checks
detekcia castych preklepov
*/
*[addr:streetnumbe][inside("CZ,SK")]{
throwError: tr("Typo detected with streetnumber");
suggestAlternative: "addr:streetnumber";
fixChangeKey: "addr:streetnumbe=>addr:streetnumber";
}

*[addr:conscriptionumber][inside("CZ,SK")]{
throwError: tr("Typo detected with conscriptionnumber");
suggestAlternative: "addr:conscriptionnumber";
fixChangeKey: "addr:conscriptionumber=>addr:conscriptionnumber";
}

Rules_CzechRepublicAddressSystem.validator.mapcss, Rules_CzechRepublicAddressSystem.zip

Last modified 6 months ago Last modified on 2017-02-16T10:42:37+01:00