New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grouping items #395

mmd-osm opened this Issue May 4, 2017 · 3 comments


None yet
3 participants

mmd-osm commented May 4, 2017

I've read this great blog post by @mojodna the other day:

Case study 3 highlights a GROUP BY use case, where the number of buildings is shown along with the building:condition. Currently, it's only possible to return all buildings via Overpass, without the grouping.

[out:csv("building:condition"; false)]

(runtime: 92ms)

Running the result through sort | uniq -c will return the desired result.

So, counting is of course possible. However, identifying each different building condition and counting the objects for each of those conditions doesn't seem to be feasible as of today.


Minimal approach:

  • New statement to remove duplicate entries based on a number of given keys, or maybe on some evaluator result (generate derived objects may be another approach)
  • Extend foreach to handle derived objects as well
remove_duplicates key = t["building:condition"];    // or something similar, maybe based on evaluators to produce a key?!
foreach -> .distinct_entry;

   way.buildings(if:t["building:condition"] == .distinct_entry..);
   make count key = .key....
              count = ...

@drolbr drolbr added the enhancement label Aug 24, 2017


This comment has been minimized.


mmd-osm commented Oct 11, 2017


Gibt es bereits ein Tool (/eine overpass-Abfrage?) o.ä., alle verwendeten keys/tags für einen bestimmten Bereich (Ort; bbox) sich in einer schlichten Liste nur mit der Zahl ihres Vorkommens anzeigen/'auswerfen' zu lassen?
Etwa nach dem Schema für Berlin:
amenity=drinking_water -> 66x


This comment has been minimized.


tyrasd commented Mar 19, 2018

looks like this is implemented in 0.7.55: #467 (comment) (second example in "for" section)?


This comment has been minimized.


mmd-osm commented Mar 29, 2018

looks like this is implemented in 0.7.55:

Yes, exactly, @mojodna's example 3 can be written as follows now:

[out:csv(count, "building:condition"; true)]
   make stat "building:condition"=_.val,
             count = count(ways);


count	building:condition
4898	average
1785	good
2420	poor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment