1

I'd like to ask overpass turbo how many objects have the same property in a given area. For instance, what is the distribution of the building tag? could return:

// for a total of 3005 buildings for instance yes: 3000 church: 3 school: 2

It would help me find where buildings have not been updated for a while, based on the source tag attribute.

  • This information is already contained in the Overpass API results. You just need to parse the file to obtain it. – scai Apr 4 '17 at 9:49
4

As suggested by @scai, I wrote a shell script doing the job:

wget -O "/tmp/file" "http://overpass-api.de/api/interpreter?data=[out:csv('source', 'building';false)][timeout:25];
    area[boundary='administrative'][admin_level='8']['name'='SomeCity']->.searchArea;
    (
      node['building'][source](area.searchArea);
      way['building'][source](area.searchArea);
      relation['building'][source](area.searchArea);
    );
    out;"
sort "/tmp/file" | uniq -c | sort -nr
| improve this answer | |
  • 1
    out:csv provides a setting to suppress the header line, i.e. by saying [out:csv('source', 'building';false]. This way you could get rid of the tail -n +1 in your script. – mmd Apr 5 '17 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.