Overpass syntax

Posting here (under a better title) my query in my other post, New tag page on the wiki?

Since that post I’ve found how to filter results on Overpass (with only an arts degree. *bows)

I can’t find how to use a NOT filter. The wiki (at Overpass QL) suggests there is one: insert ! before the value you’re searching on.

My search is currently

[out:json][timeout:25];
// gather results
(
  // query part for: “waterway=floating_barrier”
  node["waterway"="floating_barrier"]({{bbox}})
  (user:richardwest);


);
// print results
out body;
>;
out skel qt;

What I’d like is all floating barriers in the world not created by richardwest. I’ve tried user!: , user:! and !user:, but they don’t change the results (nor do they throw a syntax error, surprisingly).

I feel sure this is something Overpass can do, if I ask it nicely. Does anyone know how? Thank you.

I remember a very similar question being asked a while back, but unfortunately I can’t remember whether it was on this forum or the other help forum, and I am unable to find it on either.

Anyway, as far as I remember it turned out to be easier to do this by set difference than by using the ! operator. That is, search for the set of all barriers of this type, then the set of all barriers of this type with the specific user, then subtract the second set from the first set.

See “communities without fire station” for an example of using set difference
https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example#Communities_without_fire_station

It can be done with a filter like:

(if: user() != "richardwest")

So there is no need to resort to the difference between two sets.

Keep in mind that you are not checking who created the node, but the user who last changed it. To find the user who created the node you would have to check version #1 of the node. I doubt if that is possible using overpass.

Thank you both.

Delighted to be shown the ‘by example’ page. This is so useful. I’m going to add a reference to it on the wiki pages where I’ve looked for exactly that and not found it.

After 45 (happy) minutes of trying to adapt the firestation query to my case, I’ve concluded it’s beyond me. I think I can see how the two sets are compared, but the definition of the area at the beginning has me confused - need to stick with (bbox). I think I need to learn Overpass QL from the bottom up.

I’ve tried a filter per your suggestion, alphensebezorger, but it seems to make no difference. I don’t know if I’m putting them it in the wrong place in the query?

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

Yes, I am: that filter applies only to relations.

Inserting alphensebezorger’s filter after each of the node, way, and relation terms (before the <;>) gives the results sought.

Could you use “nwr” to replace the three separate searches with one? Same result, but if it works, maybe easier to work with if you want to further refine the query,

That does seem to work. Good shout!