x

Overpass turbo query, @count use


  1. Overpass turbo query, @count use · ABZ_OSM (Gast) · 01.01.2019 14:24 · [flux]

    http://overpass-turbo.eu/s/ESJ

    Remove // from line 6 and run again. You now see the house count and total at the bottom of the page when you scroll down.

    How can I get it to display it this way:

    @count addr:street
    113 Thistle Drive
    81 Argyl Place
    194

    I don't need to see every house being listed.

    And as an enhancement, can it be done all in one query, both display the map and the count without having to run the query twice?

    Apologies for posting english in German forum. It looks like the most active forum.


    • Re: Overpass turbo query, @count use · mmd (Gast) · 01.01.2019 14:34 · [flux]

      ABZ_OSM wrote:

      And as an enhancement, can it be done all in one query, both display the map and the count without having to run the query twice?

      That's not possible, as it woud mean to return both CSV and XML format at the same time. What you want is basically:

      [out:csv(num,"addr:street")];
      
      way["addr:street"]({{bbox}});
      for(t["addr:street"])
      (
      make␣stat␣num=count(ways),"addr:street"=_.val;
      out;
      );
      

    • Re: Overpass turbo query, @count use · ABZ_OSM (Gast) · 01.01.2019 15:20 · [flux]

      http://overpass-turbo.eu/s/EST

      Is there a way to get this to sum the count producing 194 in the last line


    • Re: Overpass turbo query, @count use · mmd (Gast) · 01.01.2019 15:34 · [flux]

      Sure:

      [out:csv(num,"addr:street")];
      
      (␣way["addr:street"~"^(Thistle␣Drive[0-9a-zA-Z␣]{0,10})$"]({{bbox}});
      way["addr:street"~"^(Argyll␣Place[0-9a-zA-Z␣]{0,10})$"]({{bbox}});
      );
      ._->.a;
      
      for(t["addr:street"])
      (
      make␣stat␣num=count(ways),"addr:street"=_.val;
      out;
      );
      
      make␣stat␣num=a.count(ways);
      out;
      

    • Re: Overpass turbo query, @count use · ABZ_OSM (Gast) · 01.01.2019 17:26 · [flux]

      Is it possible to have this result on the data tab http://overpass-turbo.eu/s/ET1
      and this result on the map tab http://overpass-turbo.eu/s/ESJ
      with one query?


    • Re: Overpass turbo query, @count use · mmd (Gast) · 01.01.2019 18:03 · [flux]

      As I said earlier that’s not possible. You cannot mix csv and json/xml in one query.


    • Re: Overpass turbo query, @count use · ABZ_OSM (Gast) · 02.01.2019 09:57 · [flux]

      What's the neatest way this can be output to json/xml on the data tab,
      with this http://overpass-turbo.eu/s/ESJ on map tab?


    • Re: Overpass turbo query, @count use · mmd (Gast) · 02.01.2019 10:39 · [flux]

      You'll need to be a bit more specific what you mean by "neatest", as I don't have a crystal ball around here. The result will always include all the nodes to display some geometry data on the map, and the stats info will be in some XML/JSON. To an average user that's probably not "neat". However, that's pretty much what's possible with overpass turbo. If it doesn't fit your needs I'm afraid you'll have to write your own web app somehow.