This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to filter by user in overpass turbo

3
2

I want to see a particular feature mapped by a given user, and the opposite (mapped by other users different to a given one). However, I see that the user value is in the Meta section, and I cannot write a query to filter by this criterion.

This is the original query, to get all monitoring stations in Colombia:

[out:xml][timeout:25];
area[name="Colombia"][admin_level=2][boundary=administrative]->.searchColombia;
(
  nwr["man_made"="monitoring_station"](area.searchColombia);
);
out meta;
>;
out meta qt;

However, I know that the user dcruizr has worked a lot on this, and I do not want to see her contributions. I was thinking about something like:

[out:xml][timeout:25];
area[name="Colombia"][admin_level=2][boundary=administrative]->.searchColombia;
(
  nwr["man_made"="monitoring_station"][user!="dcruizr"](area.searchColombia);
);
out meta;
>;
out meta qt;

However, this does not do any filter on the data. How can I write a query to filter by user?

asked 22 Jan '22, 19:51

AngocA's gravatar image

AngocA
281232433
accept rate: 0%


2 Answers:

5

As an update to DaveF's answer, you now can negatively filter for users:

area[name=Colombia][admin_level=2];
nwr[man_made=monitoring_station](area)(if:user()!="dcruizr");
out meta;
>;
out meta qt;

The if conditional allows for free-form boolean operations. The only restriction is that it only works in combination with another conditional, because one otherwise could too easily ask accidentally for the whole planet.

answered 22 Jan '22, 21:23

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

4

It's irritating we can't negate user's input directly in overpass.

The Data variable is used so the search for the user is only performed on the monitoring_stations returned & not the whole of Columbia, speeding it up slightly.

Note user uses a colon, not an equals sign.

https://overpass-turbo.eu/s/1fjq

area[name=Colombia][admin_level=2];
(
 nwr[man_made=monitoring_station](area)->.Data;
 -nwr.Data(user:dcruizr);
);
out meta;
>;
out meta qt;

answered 22 Jan '22, 20:45

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

edited 22 Jan '22, 20:45

1

Thank you for your answer. I'm just adding an extra answer, because there are more semantics available now.

(22 Jan '22, 21:15) Roland Olbricht

Source code available on GitHub .