drolbr/Overpass-API — pull request #138 by mmd-osm (2014-09-28 21:12:40+00:00)
Title:  'count' output 

Fixes #109.

This PR depends on #135, i.e. pull request 135 (csv output) needs to be applies first.

Example:

[out:csv("@count";false)];
area[name="Saarland"][boundary]->.a;
(node(area.a)[amenity=pharmacy];
way(area.a)[amenity=pharmacy];
relation(area.a)[amenity=pharmacy];);
out count;

Overpass API result:

`239`

In JSON/XML mode, fields "total", "nodes", "ways", "relations" and "areas" will be printed according to the occurrence in the input set.

XML Example:

The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.

JSON Example:

{
"version": 0.6,
"generator": "Overpass API",
"osm3s": {
"timestamp_osm_base": "",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [

{
"count": {
"total": 3171,
"nodes": 0,
"ways": 0,
"relations": 3171,
"areas": 0
}
}

]
}

In CSV mode these values are exposed through the following artificial keys:

`
@count, @count:nodes, @count:ways, @count:relations and @count:areas
`