Overpass - Some buildings not defined as such

Hey there! I’m new to the forums and a bit less new to OSM and Overpass, so forgive me if I overlook some of the more obvious solutions.

I’m working with queries that pull all the buildings in an area via Overpass. For example:


node(34.1674996523779,-118.508148193359,34.1765892428501,-118.497161865234);way(bn)['building'];(._;>;);out;

If you run this on Overpass Turbo, you can see that near the middle of the screen, Apartments #6416841 is not highlighted as a building, whereas right next to it, Apartments #431388565 is. (These are the ids found using the Query Features button on OSM proper.)

If I modify the query like so


node(34.1674996523779,-118.508148193359,34.1765892428501,-118.497161865234);way(bn)['building'];(._;>;);out;

We can see that all the ways are properly defined, but for some reason via Overpass, Apartments #6416841 is not being considered a building. The buildings that are defined as such are filled in yellow, but the problem ones aren’t.

Is this a matter of editing the OSM data and attaching the building’s ways to an area or relation, or is it an issue with Overpass, since it seems to be working properly with the Query Features button on OSM itself?

Thanks in advance for any light you might be able to shed on the topic, and do let me know if there’s any clarification I can provide.

Yes, the building in question belongs to a relation: http://www.openstreetmap.org/relation/6416839

In your query, you only query for nodes and ways with a building=* tag. This doesn’t really match with the way this building is mapped.

You would have to extend your query to also check for relations with a building tag.

Straight forward approach would be to use the overpass turbo wizard to generate the following:


/*
This has been generated by the overpass-turbo wizard.
The original search was:
“building=*”
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “building=*”
  node["building"]({{bbox}});
  way["building"]({{bbox}});
  relation["building"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

Thank you very much, that looks like it’ll do the trick!