User:M!dgard/Overpass queries

From OpenStreetMap Wiki
Jump to: navigation, search

Use the steering wheel icon to the right of the code to load it in Overpass turbo at https://overpass-turbo.eu/.

Map of post code areas

You can build a basic map of post codes in Belgium with this query. Postal code areas are complete in Flanders and Brussels.

try it yourself in overpass-turbo
[timeout:60];
area["name:en"=Belgium]->.boundaryarea;

relation[boundary=postal_code](area.boundaryarea);
out body;
>;
out skel qt;

{{style:
  relation         { text: postal_code; fill-color: #A8EA8D; fill-opacity: 0.05; color: #000; width: 1; opacity: 1; }
  relation:active  { color: #50BD23; fill-opacity: 0;   width: 3; }
  relation:tainted { color: #F00;    fill-opacity: 0.5; fill-color: #F00; }
}}

Map of pipelines in Belgium

Run with suggested settings: https://overpass-turbo.eu/s/Ckg

try it yourself in overpass-turbo
[out:json][timeout:120];

area["name:en"=Belgium]->.searchArea;
way[man_made=pipeline](area.searchArea);
out body; >; out skel qt;

{{style:
way { color: #555; opacity: 0.8; width: 2; }
way[type], way[substance=natural_gas]
 /* incorrect tags: pink */ { color: #ff00bd; }
way[substance=water]        { color: #005eff; }
way[substance=gas]          { color: #ff5800; }
way[substance=hydrogen]     { color: #8a00cf; }
way[substance=oxygen]       { color: #00cec6; }
way[substance=nitrogen]     { color: #ff0800; }
way[substance=kerosene]     { color: #04de6b; }
way[substance=fuel]         { color: #277005; }
way[substance=hydrocarbons] { color: #c1de04; }
way[substance=beer]         { color: #7d4f0d; }
way:active { opacity: 1; width: 3; }
}}

QA: wrong tagging

These export to XML, ready to load in JOSM.

Stuff tagged with tel=* instead of phone=*

try it yourself in overpass-turbo
[out:xml][timeout:10];
(
  node["tel"~"[0-9]{2}"];
  way["tel"~"[0-9]{2}"];
  relation["tel"~"[0-9]{2}"];
);
out meta qt;
>;
out meta qt;

Stuff with illegal format for phone=*

try it yourself in overpass-turbo
[out:xml][timeout:120];
(
  node[phone][phone!~"^\\+[0-9]{1,3} [0-9 -]+(;\\+[0-9]{1,3} [0-9 -]+)*$"]({{bbox}});
  way[phone][phone!~"^\\+[0-9]{1,3} [0-9 -]+(;\\+[0-9]{1,3} [0-9 -]+)*$"]({{bbox}});
  relation[phone][phone!~"^\\+[0-9]{1,3} [0-9 -]+(;\\+[0-9]{1,3} [0-9 -]+)*$"]({{bbox}});
);
out meta qt; >; out meta qt;

Stuff incorrectly mapped with postal_code=* in Flanders

Anything that isn't a postal code boundary is not allowed to have the tag postal_code=*. Postal code boundaries in Flanders are complete, so it's safe to remove postal_code=* from other objects (after checking that they match with the value of the postal code area they're in).

try it yourself in overpass-turbo
[out:xml][timeout:120];
area["name"="Vlaanderen"]->.boundaryarea;
(
  (
    node["postal_code"](area.boundaryarea);
    way["postal_code"](area.boundaryarea);
    relation["postal_code"](area.boundaryarea);
  );
  - relation["boundary"="postal_code"];
);
out meta qt;
>;
out meta qt;

Old-style pipeline tagging in Belgium

try it yourself in overpass-turbo
[out:json][timeout:120];

area["name:en"=Belgium]->.searchArea;
way[man_made=pipeline][type](area.searchArea);
out body; >; out skel qt;

DO NOT just change the tag. This is a great opportunity to follow the pipelines on the aerial imagery and improve the trajectory where possible.