Searching multiple tags while excluding some at the same time

Hello everyone

I want to create an overpass turbo query where I can filter out all of the “amenity=drinking_water” from the “landuse=cemetery”. I need this for a project that I am working on.

I have basic knowledge of overpass so i can only filter on finding all of the cemeteries and drinking water, other than that nothing comes up.

But the ultimate goal is to see all of the drinking water of an area, while excluding the ones that are inside of cemetery area’s.

Is there a way to filter this maybe based on location or distance of a cemetery? I am open to any suggestion.

2 Likes

Hi sandersdopper,

I’m not an Overpass expert, but meanwhile you wait for a more knowledgeable response you can try this:

[out:xml];
{{geocodeArea:London}}->.searchArea; //replace London with the desired area
wr["landuse"="cemetery"](area.searchArea)->.cemeteries;
 (
	nwr["amenity"="drinking_water"](area.searchArea);
   -
 (
    nwr["amenity"="drinking_water"](area.cemeteries);
	);
);
out meta;
>;
out meta qt;

Hi,

I believe something like this would work:

way[landuse=cemetery]({{bbox}});
map_to_area;
node(area)[amenity="drinking_water"];
1 Like

this works, thank you very much!

this works amazing thankyou very much!

Do you know if it is possible to add multiple filters to the query?

I would like to filter out the drinking water on; cemeteries, campsites, public toilets and inside of building.

I understand this might be much but it would help tremendously in my project!

For that you need a simple union block.
You can use this one to get inner features:

(
  way[landuse=cemetery]({{bbox}});
  way[tourism="camp_site"]({{bbox}});
  way[building]({{bbox}});
  way[amenity=toilets]({{bbox}});
);
map_to_area;
node(area)[amenity="drinking_water"];
out;

and this for features outside areas of interest:

node[amenity="drinking_water"]({{bbox}})->.allFeatures;
(
  way[landuse=cemetery]({{bbox}});
  way[tourism="camp_site"]({{bbox}});
  way[building]({{bbox}});
  way[amenity=toilets]({{bbox}});
);
map_to_area;
node(area)[amenity="drinking_water"] -> .innerFeatures;

(.allFeatures; - .innerFeatures;);

out;

thankyou very much.

Unfortunately the query is too big too load for me. I was thinking to do it on scale of a country but it takes too much time/memory to load this.

Do you have any workaround for it?

If the issue is about your web browser unable to render a large amount of data I suggest to use, in Overpass Turbo, the Export button and then select raw data from Overpass API… assuming that you need raw data for post-processing.
Generally speaking a (big)country wide query takes a lot of time and resources especially if it’s not “simple” like in your case, so splitting your area in smaller ones would help.

1 Like