0

I have a query in overpass turbo, which searches for all buildings in the current bounding box (http://overpass-turbo.eu/s/Dgv). I would like to exclude buildings with certain id's from the output - e.g. the house no. 14 in the center with OSM id=93778916.

Any ideas how to do that?

After reading some other posts I understand, that the Overpass QL "if:" statement might work. But I really have to clue how to use it.

2

In this case, I would use the difference statement and simply substract buildings with a given id. The following example excludes way ids 93778916 and 209000787.

[out:json][timeout:25];
(way[building=yes]({{bbox}}); 
 -
 way(id:93778916, 209000787);
);     
out body;
>;
out skel qt;
  • Thanks very much, mmd! So easy and straight forward! – René K Oct 31 '18 at 18:54
  • One more question, if you don't mind: Imagine I don't wannt to exclude elements by id but by OSM tag (e.g. wikidata=""). Is that also possible? Tried many different variants but none seems to work: overpass-turbo.eu/s/DhN – René K Nov 1 '18 at 14:34
  • You don't need any difference statement in this case, just use the exlamation mark to negate the search: relation["admin_level"][!"wikidata"]({{bbox}}); out geom; – mmd Nov 1 '18 at 16:14
  • But only certain Wikidata id's should be excluded. So I would like to search for all relations which have the admin level and wikidata tag. But some of the elements with a certain wikidata value I want to exclude from the result. – René K Nov 1 '18 at 16:51
  • Please open up a new question, this discussion has nothing to do with the original topic. – mmd Nov 1 '18 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.