Schwerpunkt der Woche/Overpass Postcodes

From OpenStreetMap Wiki
Jump to navigation Jump to search

Overpass Query für Postcodes Wochenaufgabe

Für die Wochenaufgabe kannst du für jedes Land eine eigene Overpass Abfrage ausführen. Diese sind entweder an der Landes- oder an einer Bundesstaaten-Area (DEU, GBR) ausgerichtet.

Sollte es zu false positives kommen, kannst du jeder Abfrage hier eine Ignore List hinzufügen - Wenn du diese hier im Wiki aktualisiert, freut sich derjenige, der im Anschluss die selbe Abfrage nutzt.

// Ignore List (false positives)
// -----------------------------
// add a new entry with
// node(id:...); or way(id:...); or relation(id:...);
// into the parentheses after the minus-sign, e.g.
//-(way(id:98029976););

ALB (Albanien)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="ALB"]->.alb; // Albania
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits, first digit cannot be zero.
	nwr(area.alb)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3})"];
);
out body;
>;
out skel qt;

AUT (Österreich)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="AUT"]->.aut; // Austria
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits, first digit cannot be zero.
	nwr(area.aut)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3})"];
);
out body;
>;
out skel qt;

BEL (Belgien)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="BEL"]->.bel; // Belgium
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits, first digit cannot be zero.
	nwr(area.bel)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3})"];
);
out body;
>;
out skel qt;

BGR (Bulgarien)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="BGR"]->.bgr; // Bulgaria
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits, first digit cannot be zero.
	nwr(area.bgr)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3})"];
);
out body;
>;
out skel qt;

BIH (Bosnien und Herzegowina)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="BIH"]->.bih; // Bosnia and Herzegovina
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	nwr(area.bih)["addr:postcode"]["addr:postcode"!~"([0-9]{5})"];
);
out body;
>;
out skel qt;

CHE (Schweiz)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="CHE"]->.che; // Switzerland
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits, first digit cannot be zero.
	nwr(area.che)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3})"];
);
out body;
>;
out skel qt;

CYP (Zypern)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="CYP"]->.cyp; // Cyprus 
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits, first digit cannot be zero.
	nwr(area.cyp)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3})"];
);
out body;
>;
out skel qt;

CZE (Tschechische Republik)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="CZE"]->.cze; // Czech Republic 
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits, 1xxxx through 7xxxx
	nwr(area.cze)["addr:postcode"]["addr:postcode"!~"([1-7][0-9]{2})([ -])?([0-9]{2})"];
);
out body;
>;
out skel qt;

DEU (Deutschland)

Zur Nutzung dieser Abfrage einfach (area.deXX) durch eine der davor aufgeführten Areas aus einem Bundesland ersetzen. Die Nutzung der Relation des kompletten Landes dauert zu lange, um sinnvoll nutzbar zu sein.

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=4]["ISO3166-2"="DE-BW"]->.debw; // Baden Württemberg
area[admin_level=4]["ISO3166-2"="DE-BY"]->.deby; // Bayern
area[admin_level=4]["ISO3166-2"="DE-BE"]->.debe; // Berlin
area[admin_level=4]["ISO3166-2"="DE-BB"]->.debb; // Brandenburg
area[admin_level=4]["ISO3166-2"="DE-HB"]->.dehb; // Bremen
area[admin_level=4]["ISO3166-2"="DE-HH"]->.dehh; // Hamburg
area[admin_level=4]["ISO3166-2"="DE-HE"]->.dehe; // Hessen
area[admin_level=4]["ISO3166-2"="DE-MV"]->.demv; // Mecklenburg-Vorpommern
area[admin_level=4]["ISO3166-2"="DE-NI"]->.deni; // Niedersachsen
area[admin_level=4]["ISO3166-2"="DE-NW"]->.denw; // Nordrhein-Westfalen
area[admin_level=4]["ISO3166-2"="DE-RP"]->.derp; // Rheinland-Pfalz
area[admin_level=4]["ISO3166-2"="DE-SL"]->.desl; // Saarland
area[admin_level=4]["ISO3166-2"="DE-SN"]->.desn; // Sachsen
area[admin_level=4]["ISO3166-2"="DE-ST"]->.desz; // Sachsen-Anhalt
area[admin_level=4]["ISO3166-2"="DE-SH"]->.desh; // Schleswig-Holstein
area[admin_level=4]["ISO3166-2"="DE-TH"]->.deth; // Thüringen
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	// Replace deXX with the area of the state you want to query
	nwr(area.deby)["addr:postcode"]["addr:postcode"!~"([0-9]{5})"];
	// Ignore List (false positives)
	// -----------------------------
	// add a new entry with
	// node(id:...); or way(id:...); or relation(id:...);
	// into the parentheses after the minus-sign, e.g.
	//-(way(id:98029976););
		-(way(id:98029976);way(id:75720871);way(id:104168034);way(id:259516307);way(id:201041144);way(id:88154603);way(id:219678463);way(id:98825241);way(id:97283641);way(id:221131560);way(id:210924643);way(id:222629607);way(id:222629150););
);
out body;
>;
out skel qt;

Falls diese Abfragen aufgrund von Zeit/Quota Beschränkungen zu keinem Ergebnis führt, hier die Alternative auf Kreisebene. Dabei besteht noch die Möglichkeit, zur numerischen Eingrenzung der Soll-Werte.

try it yourself in overpass-turbo
[out:json][timeout:1260];
area[admin_level=6][name="Stuttgart"]->.sea; 

// Stuttgart: starting with "70" followed by 3 digits from zero to nine
(
  node(area.sea)["addr:postcode"]["addr:postcode"!~"^70[0-9]{3}$"];
  way(area.sea)["addr:postcode"]["addr:postcode"!~"^70[0-9]{3}$"];
  rel(area.sea)["addr:postcode"]["addr:postcode"!~"^70[0-9]{3}$"];
	// Ignore List (false positives)
	// -----------------------------
	// add a new entry with
	// node(id:...); or way(id:...); or relation(id:...);
	// into the parentheses after the minus-sign, e.g.
	//-(way(id:98029976););
//	-(way(id:98029976););
);
out body;
>;
out skel qt;

Zum Zeitpunkt der Erstellung findet die Abfrage 2 Fehler, 1 Node + 1 Way.

DNK (Dänemark)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="DNK"]->.dnk; // Denmark
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits, first digit cannot be zero.
	nwr(area.dnk)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3})"];
);
out body;
>;
out skel qt;

ESP (Spanien)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="ESP"]->.esp; // Spain
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits, 0xxxx through 52xxx
	nwr(area.esp)["addr:postcode"]["addr:postcode"!~"([0-4][0-9]{4}|5[0-2][0-9]{3})"];
);
out body;
>;
out skel qt;

EST (Estland)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="EST"]->.est; // Estonia
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits, first digit cannot be zero.
	nwr(area.est)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{4})"];
);
out body;
>;
out skel qt;

FIN (Finnland)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="FIN"]->.fin; // Finland
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	nwr(area.fin)["addr:postcode"]["addr:postcode"!~"([0-9]{5})"];
);
out body;
>;
out skel qt;

FRA (Frankreich)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="FRA"]->.fra; // France
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	nwr(area.fra)["addr:postcode"]["addr:postcode"!~"([0-9]{5})"];
);
out body;
>;
out skel qt;

GBR (Vereinigtes Königreich von Großbritannien und Nordirland)

Bei Verwendung von area[admin_level=2]["ISO3166-1:alpha3"="GBR"] werden die Postcodes in Nordirland nicht korrekt zu dem regulären Ausdruck gematcht, daher Verwendung der einzelnen Landesteile auf admin_level=4 in einer Abfrage.

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=4]["ISO3166-2"~"GB-(ENG|SCT|WLS)"]->.gbn; // Great Britain
area[admin_level=4]["ISO3166-2"="GB-NIR"]->.nir; // Northen Ireland
(
	// Alpha Numeric
	nwr(area.gbn)["addr:postcode"]["addr:postcode"!~"[A-PR-UWYZ](([A-HK-Y])?[0-9]{1,2}|[0-9][A-HJKSTUW]|[A-HK-Y][0-9][ABEHMNPRVWXY])([ ])?[0-9][ABD-HJLNP-UW-Z]{2}"];
	nwr(area.nir)["addr:postcode"]["addr:postcode"!~"[A-PR-UWYZ](([A-HK-Y])?[0-9]{1,2}|[0-9][A-HJKSTUW]|[A-HK-Y][0-9][ABEHMNPRVWXY])([ ])?[0-9][ABD-HJLNP-UW-Z]{2}"];
);
out body;
>;
out skel qt;

GGY (Guernsey)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="GGY"]->.ggy; // Guernsey
(
	// Alpha Numeric
	nwr(area.ggy)["addr:postcode"]["addr:postcode"!~"(GY[0-9]{1,2}|GY[0-9][A-HJKSTUW])([ ])?[0-9][ABD-HJLNP-UW-Z]{2}"];
);
out body;
>;
out skel qt;

IMN (Insel Man)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="IMN"]->.imn; // Isle of Man
(
	// Alpha Numeric
	nwr(area.imn)["addr:postcode"]["addr:postcode"!~"(IM[0-9]{1,2}|IM[0-9][A-HJKSTUW])([ ])?[0-9][ABD-HJLNP-UW-Z]{2}"];
);
out body;
>;
out skel qt;

JEY (Jersey)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="JEY"]->.jey; // Jersey
(
	// Alpha Numeric
	nwr(area.gbr)["addr:postcode"]["addr:postcode"!~"(JE[0-9]{1,2}|JE[0-9][A-HJKSTUW])([ ])?[0-9][ABD-HJLNP-UW-Z]{2}"];
);
out body;
>;
out skel qt;

GRC (Griechenland)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="GRC"]->.grc; // Greece
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits, 1xxxx through 85xxx
	nwr(area.grc)["addr:postcode"]["addr:postcode"!~"([1-7][0-9]{4}|8[0-5][0-9]{3})"];
);
out body;
>;
out skel qt;

HRV (Kroatien)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="HRV"]->.hrv; // Croatia
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits, 1xxxx through 53xxx
	nwr(area.hrv)["addr:postcode"]["addr:postcode"!~"([1-4][0-9]{4}|5[0-3][0-9]{3})"];
);
out body;
>;
out skel qt;

HUN (Ungarn)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="HUN"]->.hun; // Hungary
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits from zero to nine
	nwr(area.hun)["addr:postcode"]["addr:postcode"!~"([0-9]{4})"];
);
out body;
>;
out skel qt;

IRL (Irland)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="IRL"]->.irl; // Republic of Ireland
(
	// Alpha Numeric
	nwr(area.irl)["addr:postcode"]["addr:postcode"!~"(D6W|[ACDEFHKNPRTVWXY][0-9]{2})([ ])?([0-9ACDEFHKNPRTVWXY]{4})"];
);
out body;
>;
out skel qt;

ITA (Italien)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="ITA"]->.ita; // Italy
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	nwr(area.ita)["addr:postcode"]["addr:postcode"!~"([0-9]{5})"];
);
out body;
>;
out skel qt;

LIE (Liechtenstein)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="LIE"]->.lie; // Liechtenstein
(
	// Smaller countries where the postcode comes from another country
	// 4 digits, incorporated in Swiss system, thus specific numbers
	nwr(area.lie)["addr:postcode"]["addr:postcode"!~"94(8[5-9]|9[0-8])"];
);
out body;
>;
out skel qt;

LTU (Litauen)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="LTU"]->.ltu; // Lithuania
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	nwr(area.ltu)["addr:postcode"]["addr:postcode"!~"([0-9]{5})"];
);
out body;
>;
out skel qt;

LUX (Luxembourg)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="LUX"]->.lux; // Luxembourg
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits from zero to nine
	nwr(area.lux)["addr:postcode"]["addr:postcode"!~"([0-9]{4})"];
);
out body;
>;
out skel qt;

LVA (Lettland)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="LVA"]->.lva; // Latvia
(
	// Special Grouping
	// 4 digits, 1xxx through 5xxx, may be preceeded by LV-
	nwr(area.lva)["addr:postcode"]["addr:postcode"!~"(LV([ -])?)?[1-5]([0-9]{3})"];
);
out body;
>;
out skel qt;

MCO (Monaco)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="MCO"]->.mco; // Monaco
(
	// Smaller countries where the postcode comes from another country
	// 5 digits, incorporated in French system, thus specific numbers
	nwr(area.mco)["addr:postcode"]["addr:postcode"!~"98([0-9]{3})"];
);
out body;
>;
out skel qt;

MLT (Malta)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="MLT"]->.mlt; // Malta
(
	// Special Grouping
	// 8 characters, 3 characters for the city dash 4 digits (first digit cannot be zero)
	nwr(area.mlt)["addr:postcode"]["addr:postcode"!~"[A-Z]{3}([ -])?([1-9][0-9]{3})"];
);
out body;
>;
out skel qt;

NLD (Niederlande)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="NLD"]->.nld; // The Netherlands
(
	// Alpha Numeric
	nwr(area.nld)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3}([ ])?([A-RT-Z][A-Z]|S[BCE-RT-Z]))"];
);
out body;
>;
out skel qt;

NOR (Norwegen)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="NOR"]->.nor; // Norway
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 4 digits from zero to nine
	nwr(area.nor)["addr:postcode"]["addr:postcode"!~"([0-9]{4})"];
);
out body;
>;
out skel qt;

POL (Polen)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="POL"]->.pol; // Poland
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	nwr(area.pol)["addr:postcode"]["addr:postcode"!~"([0-9]{2})([ -])?([0-9]{3})"];
);
out body;
>;
out skel qt;

PRT (Portugal)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="PRT"]->.prt; // Portugal
(
	// Special Grouping
	// 8 characters, 4 digits (first digit cannot be zero) dash 3 digits
	nwr(area.prt)["addr:postcode"]["addr:postcode"!~"([1-9][0-9]{3})(([ -])?[0-9]{3})?"];
);
out body;
>;
out skel qt;

ROU (Rumänien)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="ROU"]->.rou; // Romania
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 6 digits from zero to nine
	nwr(area.rou)["addr:postcode"]["addr:postcode"!~"([0-9]{6})"];
);
out body;
>;
out skel qt;

SMR (San Marino)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="SMR"]->.smr; // San Marino 
(
	// Smaller countries where the postcode comes from another country
	// 5 digits, incorporated in Italian system, thus specific numbers
	nwr(area.smr)["addr:postcode"]["addr:postcode"!~"4789[0-9]"];
);
out body;
>;
out skel qt;

SRB (Serbien)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="SRB"]->.srb; // Serbia 
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	nwr(area.srb)["addr:postcode"]["addr:postcode"!~"([0-9]{5})"];
);
out body;
>;
out skel qt;

SWE (Schweden)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="SWE"]->.swe; // Sweden 
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits from zero to nine
	nwr(area.swe)["addr:postcode"]["addr:postcode"!~"([0-9]{3})([ -])?([0-9]{2})"];
);
out body;
>;
out skel qt;

SVK (Slowakei)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="SVK"]->.svk; // Slovakia 
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits, 0xxxx and 8xxxx through 9xxxx
	nwr(area.svk)["addr:postcode"]["addr:postcode"!~"([089][0-9]{2})([ -])?([0-9]{2})"];
);
out body;
>;
out skel qt;

TUR (Türkei)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="TUR"]->.tur; // Turkey 
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits, 0xxxx through 81xxx
	nwr(area.tur)["addr:postcode"]["addr:postcode"!~"([0-7][0-9]{4}|81[0-9]{3})"];
);
out body;
>;
out skel qt;

VAT (Vatikanstadt)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="VAT"]->.vat; // Vatican City 
(
	// Smaller countries where the postcode comes from another country
	// 5 digits, incorporated in Italian system, thus specific numbers
	nwr(area.vat)["addr:postcode"]["addr:postcode"!~"00120"];
);
out body;
>;
out skel qt;

XXK[1] (Kosovo)

try it yourself in overpass-turbo
[out:json][timeout:3600];
area[admin_level=2]["ISO3166-1:alpha3"="XXK"]->.xxk; // Kosovo
(
	// Plain digits (may be grouped or not all digits are allowed)
	// 5 digits, 1xxxx through 7xxxx
	nwr(area.xxk)["addr:postcode"]["addr:postcode"!~"([1-7][0-9]{4})"];
);
out body;
>;
out skel qt;
  1. Die Relation des Kosovo (https://www.openstreetmap.org/relation/2088990) hat XXK im Tag ISO3166-1:alpha3 stehen. Eine Abweichung zur offiziell von Serbien anerkannten Benennung (Eigenes Gebiet, also ISO3166-2:RS-KM) oder der deutschen Wikipedia (XKX) sind derzeit unvermeidlich, sollen aber nicht als Teil dieser Wochenaufgabe betrachtet werden.