2

I'm trying to find all buildings in ways AND relations, type=multipolygon. The code below works but only finds buildings in ways but not in the relation, type=multipolygon for 'landuse=military'. I know how to output the rel[landuse=military], but not how to feed those relations nodes into the is_in with the ways nodes.

[out:json];
(

way[landuse=military]({{bbox}});

);

node(w);is_in;
area._[landuse=military];
(
     way(area)[building];
     node(w);
);
out;
2

I would suggest a completely different approach:

[out:json]
[bbox:{{bbox}}];

( way[landuse=military];
  rel[landuse=military]; );
map_to_area;
way(area)[building];
out geom;

Try it in overpass turbo: http://overpass-turbo.eu/s/sJa

way + rel + map_to_area effectively returns all landuse=military areas in your bounding box, but since area[landuse=military] doesn't support a bbox filter, we have to take this slightly more complicated approach.

Take particular note that map_to_area is subject to area creation rules, which typically means that your area needs to have a name=* tag. Otherwise no respective area exists on the server. This behavior is documented as such, and not a bug.

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.