Ty Lasky
Ty Lasky

Reputation: 35

Overpass API query for specific store names

I am trying to find Costco (or similar) stores in a given area. I have tried a few queries with no luck so far. Currently I'm using Turbo, but I believe I know how to switch to http and JSON. Any advice n a working query is greatly appreciated.

Attempts include:

(a) node [name=Costco] ({{bbox}}); out;

This runs, but no results where I know there should be.

(b) node [brand:wikipedia=en:Costco] ({{bbox}}); out;

I found the brand info in results for an OpenStreetmaps search, so I think the data is in the database.

This gives error An error occurred during the execution of the overpass query! This is what overpass API returned:

Error: line 10: parse error: '!', '~', '=', '!=', or ']' expected - ':' found.

Error: line 10: parse error: ']' expected - ':' found.

Upvotes: 1

Views: 1907

Answers (1)

scai
scai

Reputation: 21469

You need to enclose brand:wikipedia and en:Costco in quotes. This should work:

node ["brand:wikipedia"="en:Costco"] ({{bbox}}); out;

Try the following query:

[out:json][timeout:25];
// gather results
(
  // query part for: “shop=* and name=Costco”
  nwr["shop"]["name"="Costco"]({{bbox}});
  // query part for: “shop=* and brand=Costco”
  nwr["shop"]["brand"="Costco"]({{bbox}});
  // query part for: “shop=* and operator=Costco”
  nwr["shop"]["operator"="Costco"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

This searches for shops with the name, brand or operator "Costco".

You can see an example at overpass-turbo: https://overpass-turbo.eu/s/16OL

Upvotes: 1

Related Questions