Overpass query example

Shops inside a mall

Turn a mapped building into an area with map_to_area and search inside it. Example: Sihlcity, Zürich.

map_to_area converts ways and relations into areas, so you can search inside any mapped outline, such as a mall, a campus or a park.

The query

[out:json][timeout:25];
wr["shop"="mall"]["name"="Sihlcity"];
map_to_area->.mall;
nwr["shop"](area.mall);
out center;

Run it

Running the query…

Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).

How it works

  1. The first line finds the outline of the mall.
  2. map_to_area->.mall turns it into an area named mall.
  3. nwr["shop"](area.mall) finds the shops inside it.

Variations

  • The same works for parks, campuses, airports: anything with an outline.

Run it from your code

curl https://api.overpass.ch/v1/YOUR_API_KEY/interpreter \
  --data-urlencode 'data@query.overpassql'

Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.

More examples

All examples →