I'm looking for the correct way to query point/polygon elements that are
name=*
but neither tagged asamenity=school
andbuilding=school
tags; and- elements tagged as
building=school
but without a parent polygon that are tagged asamenity=school
(to mark the school grounds)
I expect to see a list of nodes or ways that are tagged as building=school
, but are not inside a closed way tagged as amenity=school
. The purpose of the query is for Q&A of school-related elements in our region.
The following is the code I use to get the initial elements I'm interested in:
[out:json]
[timeout:25];
(
node
[name ~ "^.school.*$",i]["building"="school"]["amenity"!~"."]({{bbox}});
way
[name ~ "^.school.*$",i]["building"="school"]["amenity"!~"."]({{bbox}});
);
//
// how to get parent poly for each resulting element?
//
// print results:
out body;
>;
out skel qt;
Best Answer
At the moment the closest possible approach is the following. It will return a number of false positives, because Overpass API doesn't have any
area
for ways withamenity=school
, lacking aname=*
tag.Try it in overpass turbo: http://overpass-turbo.eu/s/der