Overpass Turbo Query help

I’m trying to get all industrial zones with at least one shop inside that zone but I can’t get my query to work.

[out:json][bbox:{{bbox}}][timeout:800];

nwr["landuse"="industrial"];
nwr["shop"](around:100)["landuse"="industrial"];
way["landuse"="industrial"];
way["shop"](around:100)["landuse"="industrial"];
relation["landuse"="industrial"];
relation["shop"](around:100)["landuse"="industrial"];

out geom;

What am I doing wrong here?

searching through the wiki help and with a lot of testing :sweat_smile: I think what you are looking for is something like this?

[out:xml][timeout:60][bbox:{{bbox}}];
wr[landuse=industrial]->.industrial_areas;
.industrial_areas map_to_area -> .sa;
nwr[shop](area.sa)->.shops_in;
.shops_in is_in;
area._[landuse=industrial]->.target_areas;
wr(pivot.target_areas);
out geom qt;

This routine outputs both the industrial areas & the shops within.

@aTarom’s routine searches using only shop nodes & is_in can’t use ways & rels. This is resolved by finding all the nodes with the way/rels shops. using: (._;>;);

There’s no need to map_to_area as landuses are now recognised automatically as areas.

There’s no need to give specific names to all selection sets.
._ is the default name for the previous selection set.

wr[landuse=industrial]({{bbox}});
nwr[shop](area);
out geom qt;
(._;>;);
is_in;
wr._[landuse=industrial];
out geom qt;
1 Like