This is a basic question, but it got me confused and I really can'T find anything. I'm a beginner with OSM, though got a map running with queries etc, all working fine. The thing is this:

When working on a map which shows locations, I wanted to -for example- show vegan restaurants. Now there are a lot of different version tagged:

(EDIT: the option "diet:vegan" (yes, no, only) has the most places located, instead of the "diet"="vegan" used in my example)

place A - cuisine: vegan place B - diet:vegan: yes place C - diet:vegan place D - cuisine: vegetarian,_vegan,_veggie_burger

  • If I use the basic query "cuisine=vegan" then result is only A.
  • when "diet=vegan" result is only C.
  • when going with a 'wildcard' ['cuisine'~'vegan',i] the result is only.. you guessed it.. A and D.

Now my main question is: Is there a simple OR operator to use? These didn't work:

['cuisine'~'vegan',i] | ['diet'~'vegan',i]
['cuisine'~'vegan',i | 'diet'~'vegan',i]

Then a not so important question/opinion left, but basically just to get more of in idea about the whole thing since I'll be needing it more with this project:

  • What is the logic behind needing extra coding to find a tag that would be great to find with just one tag 'vegan' (result true or false) or something similar?

I've read the documents on language and tagging, key etc, though can't understand the reason behind it. Of course there are thousands of possibilities to tag and it's been doing pretty great so far considering the size of the community working on it, though wouldn't it be an improvement keeping things like this a bit more basic and avoiding -for this example- the tags 'diet', 'cuisine' and just leave the options 'vegan' as a tag itself (true/false), maybe with option to go 'vegan:only'?

asked 06 Jan, 14:19

tijmenheid's gravatar image

tijmenheid
26227
accept rate: 0%

edited 09 Jan, 18:54

2

The reason you need "extra" queries is that there is no enforced or standardized tagging in OSM. Each mapper can choose to create his or her own version of the vegan tag, as you've just learned the hard way.

To make matters worse, many tags have spelling variations that are either intentional or accidental. These need to be accounted for too if you want complete results.

(07 Jan, 10:55) AlaskaDave

Thanks AlaskaDave, though i haven't seen the OSM editor but I was convinced there should be a pre-made list of tags to add on a click. Like "amenity is restaurant? well then here are all the standard tags: listoftags. Click to add. (max. 5)" Or something like that.

It might be an idea to filter out the non-registered tags (spelling variations etc) and add them to an 'extra' tag or something? f.e. [vegan:true, extra:vegan_pizza,vegetarian_pasta,etc]. Is there a good place to just dump ideas-that-might-work without having to discuss them?

(07 Jan, 16:29) tijmenheid

Currently there are 72 481 different keys with 99 519 867 different values. One does not simply walk into mordor clean this up. Also see any tags you like for reasons why any mapper is allowed to create new tags.

(08 Jan, 08:00) scai ♦

Yeah I've seen that page, and haven'T walked into Mordor, since I'm not sure if they have good coffee. Referring to the tags, it was more to get back to the only applying principle of "Keep It Simple, Silly." So not the tag itself, but how to find it with 1 simple query, like it's supposed to.

In the 4 examples (mentioned in my question) using the proposed '=' operator, I would have to do a minimum of 4 queries to find 1 tag, and not many people are aware of that, which means they would miss out 30-60% of all vegan places on a map. I'm sure this is not the intention of 'Tags' and could be avoided by restricting the use of 'well-known' tags in certain keys and filtering out the ones with basic grammar-errors or just replace them to the right key.

(08 Jan, 10:38) tijmenheid
2

You can discuss all of this on the tagging list but there really won't be any resolution forthcoming. OSM tags are chaotic because it allows anyone the freedom to create any tag they like. On the one hand, this is wonderful and liberating but if you are forced to deal with it programmatically you have an uphill battle on your hands. OSM also strongly discourages any sort of mass-editing so in many cases, even that of a mis-spelled tag, errors can persist ad infinitum.

Welcome to the world of OSM.

You can signup for the tagging list here: https://lists.openstreetmap.org/listinfo/tagging

Dave

(08 Jan, 14:37) AlaskaDave

Ok will give it a try, you never know, thanks for the info!

(08 Jan, 22:04) tijmenheid
showing 5 of 6 show 1 more comments

You have to use the union "( )" operator in Overpass. The following query is constructed via the "Wizard" of OverpassTurbo. I just typed in "diet~vegan OR cuisine~vegan" and it gave me the query: http://overpass-turbo.eu/s/F1B

permanent link

answered 07 Jan, 04:15

escada's gravatar image

escada
16.5k16136261
accept rate: 21%

In case this website goes (temporarily) down, the resulting query is:

[out:json][timeout:25];
// gather results
(
  // query part for: “diet~vegan”
  node["diet"~"vegan"]({{bbox}});
  way["diet"~"vegan"]({{bbox}});
  relation["diet"~"vegan"]({{bbox}});
  // query part for: “cuisine~vegan”
  node["cuisine"~"vegan"]({{bbox}});
  way["cuisine"~"vegan"]({{bbox}});
  relation["cuisine"~"vegan"]({{bbox}});
);
// print results
out body;
>;
out skel qt;
(07 Jan, 07:39) scai ♦
2

Thanks mate! I didn'T knew about the 'wizard' menu in overpass-turbo, dôh! Learned it now.

Minimizing the code with the semi-new 'nwr[]', it would be: ( nwr"diet"~"vegan";
nwr"cuisine"~"vegan"; );

Will try it out!

(07 Jan, 16:12) tijmenheid
Your answer
toggle preview

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:

×142
×47
×23
×6

question asked: 06 Jan, 14:19

question was seen: 344 times

last updated: 09 Jan, 18:54

powered by OSQA