Search notes:

Overpass API function count

count counts the number of objects with a given type (nodes, ways etc.) and hence takes exactly one argument which must be one of the unqouted strings nodes, ways, relations, deriveds, nwr, nw, wr or nr.
Because count is an aggregation function, it might be used in conjunction with the for statement.
[out:csv(
   val,
   cnt_n,
   cnt_w,
   cnt_r,
   cnt_nw,
   cnt_wr,
   cnt_nr,
   cnt_nwr,
   cnt_d
)];

{{geocodeArea:Pfungen}};

nwr[highway](area);

for (t['highway']) {

   make x
      val      = _.val,
      cnt_n    = count(nodes    ),
      cnt_w    = count(ways     ),
      cnt_r    = count(relations),
      cnt_nw   = count(nw       ),
      cnt_wr   = count(wr       ),
      cnt_nr   = count(nr       ),
      cnt_nwr  = count(nwr      ),
      count_d  = count(deriveds );

   out;

}

See also

Overpass API: functions

Index