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

EDIT: using overpass-turbo

I have been looking for all shop=alcohol in Poland and finding their respective administration boundaries since the addresses are seldom complete.

So far I have this;

[out:json][timeout:3000];

{{geocodeArea:Poland}}->.searchArea;

node[shop="alcohol"](area.searchArea)->.posts;

foreach.posts(
  out;
  is_in;
  area._[admin_level~"[467]"];
  out ids;
);

// collect area details in 2nd step
.posts is_in;
area._[admin_level~"[467]"];
out;

which is almost a direct copy from this post https://help.openstreetmap.org/questions/35976/add-reverse-geocoding-information-to-the-overpass-resulting-set

however I also need to add ways, since many of the shops have been charted that way. Therefore I tried the following;

[out:json][timeout:3000];

{{geocodeArea:Poland}}->.searchArea;

node[shop="alcohol"](area.searchArea)->.posts;
way[shop="alcohol"](area.searchArea)->.posts;

foreach.posts(
  out;
  is_in;
  area._[admin_level~"[467]"];
  out ids;
);

// collect area details in 2nd step
.posts is_in;
area._[admin_level~"[467]"];
out;

However this bugs out and the auto help, well...doesn't.

Anyone?

Thanks in advance;

asked 11 Aug '16, 15:25

scass's gravatar image

scass
21337
accept rate: 0%

edited 11 Aug '16, 15:41


There are basically two issues in your second query:

  1. Inputset union is needed to store all nodes and ways in .posts
  2. is_in; does only work on nodes, that's why an additional recursion step is needed as well to turn ways into their respective nodes - namely (._;>;); and (.posts;>;); in the query below.

Here's how the query should look like:

[out:json][timeout:3000];

{{geocodeArea:Poland}}->.searchArea;

(node[shop="alcohol"](area.searchArea);
 way[shop="alcohol"](area.searchArea);)->.posts;

foreach.posts(
  out center;
  (._;>;);
  is_in;
  area._[admin_level~"[467]"];
  out ids;
);

// collect area details in 2nd step
(.posts;>;);
is_in;
area._[admin_level~"[467]"];
out;
permanent link

answered 11 Aug '16, 15:52

mmd's gravatar image

mmd
5.7k15388
accept rate: 37%

edited 11 Aug '16, 15:55

this appears to work perfectly, i'm going to have to read into recursion syntax.

Thanks for your help

(11 Aug '16, 15:58) scass

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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:

×167
×83
×63

question asked: 11 Aug '16, 15:25

question was seen: 2,105 times

last updated: 11 Aug '16, 15:58

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