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

# Count number of NWR per each of the input sets

 0 I have the follow Overpass Turbo query, and I would count number of NWR per each of the input sets. That is: 1) number of NWR for Trader Joe's 2) number of NWR for Safeway I tried many times, and still not sure how to make it, can someone help please? [out:json][timeout:60]; (nwrbrand="Trader Joe's";)->.TJ; (nwrbrand="Safeway";)->.SW; (.TJ; .SW;); out skel center count; asked 06 Feb '21, 07:53 steve_nonego 10●1●1●3 accept rate: 0%

 1 You can use the make statement to create your own count elements: ``````[out:json][timeout:60]; nwr[brand="Trader Joe's"]; make count brand = set(t["brand"]), total = count(nwr); out; nwr[brand="Safeway"]; make count brand = set(t["brand"]), total = count(nwr); out; `````` For further information: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#The_statement_make See also this example answered 06 Feb '21, 09:37 MarcoR 687●3●8●20 accept rate: 23% @MarcoR Thanks for you solution, it does what I expected! I look up the links you recommend, yet I still not fully understand the query. Can you help me to understand the following? For: nwrbrand="Trader Joe's"; make count brand = set(t["brand"]), total = count(nwr); out; 1) We didn't give the nwr[] a input set name, so it's automatically assume the set( ) is refer to the one above? 2) I look up the examples, it also use t["xxxx"], what is the t refer to? tag? Last but not least, I slightly modified the query as: [out:json][timeout:60]; nwrbrand="Trader Joe's"; make count category = set("Number of Trader's"), total = count(nwr); out; nwrbrand="Safeway"; make count brand = set("Number of Safeway"), total = count(nwr); out; (07 Feb '21, 19:33) steve_nonego 1 You are welcome ;) 1) The input set, if not specified, is the default one: _; as far as I undestand, nwr[…], doesn't have an input set as all it does is searching data in the map database, but it has an output set, which is _; this set is used as input set by the following command (make …); the next nwr[…] overwrites the default set with the new results so that the following 'make' statament can calculate the proper results; 2) t["xxx"] returns the value of the tag "xxx"; see https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Tag_Value_and_Generic_Value_Operators Hope this helps! (08 Feb '21, 09:38) MarcoR

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×8
×1

question asked: 06 Feb '21, 07:53

question was seen: 948 times

last updated: 08 Feb '21, 09:39

### Related questions

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