overpass turbo: number of features

I would like to modify a simple overpass turbo query, for example


but I need only the number of buildings, no matter where they are on the map. I would like to know for example the number of buildings in my city. But running such query will force to download a lot of MB of data. How to do that?

You can dorst download an extract for that area you are interested in.

sources for that are listed at https://wiki.openstreetmap.org/wiki/Planet.osm

Some web services have feature to download raw data limited by a self drawn polygon, see bbbike.org or protomaps.com

Maybe https://wiki.openstreetmap.org/wiki/Osmfilter is a useful tool for filtering all objects with building=*

then try https://wiki.openstreetmap.org/wiki/Osmconvert

which has a feature to to write CSV file as output.

Then count all building objects with a spreadsheet software loke LibreofficeCalc or Excel or similar.

The Overpass Query Language (Overpass QL) includes a statement to count the number of elements without downloading the actual elements:

out count;

This will return the number of elements, split up into nodes, ways and relations, and the total.
Just add this statement after your query for buildings, and don’t use any other out statement to avoid downloading the actual elements:

// print result count
out count;

In overpass-turbo.eu you can find the results under the Data tab. There should be no results visible on the map of course, displaying the buildings would require downloading the data.

Documentation for the “out count” statement can be found here: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#out

This is possible using “out count” or the statistical count; There are examples in the documentation on the wiki: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Statistical_Count

I saw it before but this doesn’t help. There are no examples how to use it.
I tried for example count(way)building=yes; but it didn’t work.
Documentation for overpass language on Wiki is really poor. There are almost no examples.

Thanks, it works.
I have another question - would it be possible to expand this query to generate a table with values for a key? For example:
888888 building=yes
7777 building=apartments
555 building=garage

There’s a Wiki page which has some examples:

As per counting diffrent tags, consider using https://ohsome.org/apps/dashboard/ , noting however you can only count at powiat level and above for Poland.

Thanks. It’s a great tool :slight_smile: I’ve even had it in my bookmarks but never used :slight_smile:

However, my question is still open.