7

I am new to overpass / OSM. I want to locate Dodo Pizza in Moscow, a specific chain of fastfood. Since these restaurants are sometimes tagged by brand and sometimes by name, I ve included a or statement in my query as explained here. I then realized that the returned results are different depending on the order of my conditions.

If I use first the tag brand, overpass doesn't return any matches

[out:json][timeout:2500];
area["name"="Москва"];
(

node(area)["brand"="Додо Пицца"];
node(area)["name"="Додо Пицца"];

);
out body;

But if I use first the tag name, overpass return 20 matches

[out:json][timeout:2500];
area["name"="Москва"];
(


node(area)["name"="Додо Пицца"];
node(area)["brand"="Додо Пицца"];


);
out body;

I am so confused, what am I doing wrong?

1 Answer 1

2

The data has changed since then, but if you run the following query now, you get 64 with brand first and 65 with name first. The reason for that is that only 64 places have the brand and name tag, and one additional one has just the name tag. The difference in order is because of the way you call the area:

If you run the following:

[out:json][timeout:2500];
area["name"="Москва"];

( node(area)["brand"="Додо Пицца"];)->.b;
out count;

area["name"="Москва"];
(node(area)["name"="Додо Пицца"];)->.a;
out count;

(.a; - .b;);
out count;

you will get (simplified here):

64
65
1

But if you don't add the second area["name"="Москва"]; :

64
0
0

That is because the area in the second call is not Moscow any more. To make the search work without calling the area again, you can fix it by adding a named area:

area["name"="Москва"]->.moscow;

(node(area.moscow)["brand"="Додо Пицца"];)->.b;
out count;

(node(area.moscow)["name"="Додо Пицца"];)->.a;
out count;

(.a; - .b;);
out count;

and you get the correct answer:

64
65
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.