NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Is it possible to build a query that just returns the number of objects of a certain type in a certain area? Possible use case: define some things that require local knowledge, run query, get a toplist of people who have been working on those things. Find local mappers! (you could even query only things that are at version 1 to have higher probability that it's original mapping) I didn't get further than this: http://overpass-turbo.eu/s/B12

Also: is this much heavier for the servers than running the query and doing the counting client-side?

asked 13 Aug '18, 14:33

joost%20schouppe's gravatar image

joost schouppe
3.4k245087
accept rate: 12%

1

It may be possible with some of the newer features. You can see similar queries (in that they group a result set and do some statistics on it) described at https://dev.overpass-api.de/blog/sliced_time_and_space.html.

I'm not certain it is possible to get the new for block to loop over users though.

(14 Aug '18, 11:30) maxerickson

That's going to be at least an interesting read. Thanks! (I'll report back here if I make progress)

(14 Aug '18, 11:37) joost schouppe

So the for loop does work on user:

[out:csv(user,total,nodes,ways,relations)][timeout:25];
{{geocodeArea:Antwerpen}}->.searchArea;
(
  way["building"="hotel"](area.searchArea);
  relation["building"="hotel"](area.searchArea);
  node["tourism"="hotel"](area.searchArea);
  way["tourism"="hotel"](area.searchArea);
  relation["tourism"="hotel"](area.searchArea);
);
for (user()){
    make stat 
     "user"=_.val,
     nodes=count(nodes),
     ways=count(ways),
     relations=count(relations),
     total = count(nodes) + count(ways) + count(relations);
    out;
};
permanent link

answered 15 Aug '18, 13:31

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×228

question asked: 13 Aug '18, 14:33

question was seen: 1,939 times

last updated: 15 Aug '18, 13:31

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum