Hi, So you can go : to only include tags that have a certain string: name:foo (only places with foo anywhere in the name will show up), but I'm wondering if you can do the opposite, I want to EXCLUDE tags if they contain a certain word (I want every tag that does NOT contain the word foo in the example above). I'm sure there must be a way, there's = and !=, so I'm sure they'll be some equivalent for contains, but it certainly isn't !: and I cannot find it in documentation. Thanks in advance for your help, Steven. asked 12 May '21, 22:53 AutisticRabbit |
Try with the operator "!~" which searches for values not matching a regular expression. Please note that not having the tag is considered a non match, thus it's shown in the result. If you want to avoid that, just add the filter ["name"]. Example:
Another way to obtain the same result is to use the difference:
The former should run faster but I think it depends on the area you are running it in. answered 13 May '21, 18:47 MarcoR |
Although MarcoR's former example is the preferable solution the 'difference' example, when it's the only option, can be improved slightly by passing the first call to a variable. In this example I display all edits for the last day except my own. (You'll need to add your own username)
answered 14 May '21, 16:30 DaveF |
Can you provide an example illustrating what you want?
I'm intrigued/confused by your first sentence. Do you have a working example to clarify what you mean?
Yes sorry, so I am wanting to see all the churches of a specific denomination, but the denomination field isn't always filled in, so I will need to do some manual filtering. I thought a way to narrow down the list though would be to exclude results that mention a denomination in it's name, so for example if it was Trinity Evangelist Church, I want to exclude all names that contain the word Evangelist.
@DaveF Sorry what I was meaning by the first sentence is that I can do the opposite, I know how to ONLY find churches that have the word Evangelist in the name, but I don't know how to EXCLUDE churches that have the word Evangelist from the results.
Sorry for the confusion.
Try with the operator "!~" which searches for values not matching a regular expression (https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Value_matches_regular_expression_.28.7E.2C_.21.7E.29); please notice that not having the tag is considered a non match, thus it's shown in the result. If you want to avoid that, just add the filter ["name"]; Example: node["amenity"="place_of_worship"]["name"]["name"!~"Evangelist"](area.searchArea);
@MarcoR Yes that worked! Thank you. If you post that as an answer, I will mark it as correct.