ES:Overpass turbo/Ejemplos/Control de calidad de códigos postales

From OpenStreetMap Wiki
Jump to navigation Jump to search
Overpass API logo.svg
edit
API de Overpass · Referencia de lenguaje · Guía de lenguaje · Términos técnicos · Áreas · Ejemplos de consultas · Edición dispersa · ID permanente · Preguntas frecuentes · más (español) · Sitio web
Estado de servidores · Versiones · Desarrollo · Diseño técnico · Instalación · Capa de compatibilidad XAPI · Esquemas de transporte público · Aplicaciones · Código fuente e incidencias
Overpass turbo · Asistente · Atajos de Overpass turbo · Hojas de estilo MapCSS · Exportar a GeoJSON · más (español) · Desarrollo · Código fuente e incidencias · Sitio web
Overpass Ultra · Examples · Overpass Ultra extensions · Hojas de estilo MapLibre · URL Params · más (español) · Código fuente e incidencias · Sitio web

broom

Help (89606) - The Noun Project.svg

(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