Overpass turbo/Examples/Postal Codes Quality Assurance

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Overpass turbo/Examples/Postal Codes Quality Assurance
· Afrikaans · Alemannisch · aragonés · asturianu · Aymar aru · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · bamanankan · Bân-lâm-gú · Basa Jawa · Basa Sunda · Baso Minangkabau · bosanski · brezhoneg · català · čeština · corsu · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · kurdî · Latina · latviešu · Lëtzebuergesch · lietuvių · Limburgs · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tagalog · Tiếng Việt · Türkçe · Türkmençe · Vahcuengh · vèneto · walon · Wolof · Yorùbá · Zazaki · isiZulu · српски / srpski · авар · Аҧсшәа · башҡортса · беларуская · български · қазақша · Кыргызча · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · भोजपुरी · मराठी · संस्कृतम् · हिन्दी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · བོད་ཡིག · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 中文(繁體)‎ · 吴语 · 粵語 · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް
Overpass API logo.svg
Overpass API · Language reference · Language guide · Technical terms · Areas · Query examples · Advanced examples · Sparse Editing · Permanent ID · FAQ · more · Web site
Servers status · Versions · Development · Technical design · Installation · XAPI compatibility layer · Public transport sketch lines · Applications · Source code and issues
Overpass turbo · Wizard · Overpass turbo shortcuts · MapCSS stylesheets · Export to GeoJSON · more · Development · Source code and issues · Web site


(This example, originally in German, originally deals with postal code boundary relations in Germany but can be used in other countries.)

Inspired by examples listed here (in German; equivalent English page here) The following comparisons can be visualized for OSM data:

Show all nodes and ways tagged with a certain postal code (addr:postcode=*) that are inside of a boundary relation tagged with the same postal code (postal_code=*)

The following query provides the possibly existing results by simply copying the code/s below and pasting it in the text section at the Overpass turbo website (http://overpass-turbo.eu):

/* Show all elements within a boundary relation with postal_code=x,
   which have the addr:postcode tag */

{{postcode=4000}} 
/* change the postal code here as you wish,
   but it must be a valid postal code of an existing boundary relation */

rel[postal_code="{{postcode}}"];(._;>;);out;
/* this line is only for visualization of the hopefully existing boundary relation,
   comment out or delete only if necessary */

area[postal_code="{{postcode}}"]->.a;
(node(area.a)["addr:postcode"]["addr:postcode"!="{{postcode}}"];
 way(area.a)["addr:postcode"]["addr:postcode"!="{{postcode}}"];)
;(._;>;);out;
/* ... Click Run (or Ctrl-Enter), and if necessary,
   let the map zoom in on the hopefully appearing data
   by clicking on the magnifying glass icon */

Here is a more extended example from User:Basstoelpel:

/* Show all elements within a boundary relation with postal_code=x,
   which have the addr:postcode tag */
{{postcode=4031}} 
/* change the postal code here as you wish,
   but it must be a valid postal code of an existing boundary relation */
rel[postal_code="{{postcode}}"];
out;
>;
out skel;
/* this line is only for visualization of the hopefully existing boundary relation,
   comment out or delete only if necessary */
area[postal_code="{{postcode}}"]->.a;
(node(area.a)["addr:postcode"]["addr:postcode"!="{{postcode}}"];
way(area.a)["addr:postcode"]["addr:postcode"!="{{postcode}}"];
rel(area.a)["addr:postcode"]["addr:postcode"!="{{postcode}}"];
way(area.a)["postal_code"]["postal_code"!="{{postcode}}"];    
node(area.a)["postal_code"];        
way(area.a)["postal_code"]["building"];
rel(area.a)["postal_code"];);
out;
>;
out skel;
/* ... Click Run (or Ctrl-Enter), and if necessary,
   let the map zoom in on the hopefully appearing data
   by clicking on the magnifying glass icon */
                            
/* Relations should also be checked since buildings with courtyards are mapped using multipolygon relations.
Please ignore roads with a tagged postal code if they overlap with a postal code that you're querying. 
Everything else with the postal_code tag can be ignored too.
*/

Notes and Tips

  • If errors are displayed, then you should carefully check if individual addr:* objects have the wrong postal code or that the border of the postal code relation is incorrect.
  • A map that shows postal code relations and boundary relations with postal code tags can be found here. Mouse over to Theme Maps, click on "Administrative boundaries" and select the "Postal Codes" layer