brand:wikidata links a shop or restaurant to the Wikidata item of the brand. It is language-independent and the same in every country, which makes it the most reliable way to find a chain.
The query
[out:json][timeout:60]; area["ISO3166-1"="CH"][admin_level=2]->.ch; nwr["brand:wikidata"="Q38076"](area.ch); out center;
Run it
Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).
How it works
- Q38076 is McDonald's on Wikidata. Look up the ID of any brand on wikidata.org.
- No
amenityfilter is needed: the brand tag alone identifies the outlets.
Variations
- Several brands at once:
["brand:wikidata"~"^(Q38076|Q177054)$"](McDonald's and Burger King). - Big countries take longer to search. Raise
[timeout:], or split the query by region.
Run it from your code
curl https://api.overpass.ch/v1/YOUR_API_KEY/interpreter \
--data-urlencode 'data@query.overpassql'
import requests
query = open("query.overpassql").read()
r = requests.post("https://api.overpass.ch/v1/YOUR_API_KEY/interpreter",
data={"data": query}, timeout=120)
r.raise_for_status()
print(r.json()["elements"][:3])
const res = await fetch("https://api.overpass.ch/v1/YOUR_API_KEY/interpreter", {
method: "POST",
body: new URLSearchParams({ data: query }),
});
if (!res.ok) throw new Error(await res.text());
console.log(await res.json());
Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.