1 instead of 2 api calls. How?

With help from Lutz I’ve made a webmap with some bicycle related tags. I want to show all cycleways with tags moped=yes OR moped=designated. I have now done this by creating 2 calls (and also 2 checkboxes in the page) but I would like to combine this in 1 call/ 1 checkbox. Does anyone know how this can be done?

Current code:

 make_layer("http://overpass-api.de/api/interpreter?data=node[highway=cycleway][moped=designated](bbox);out+skel;(way[highway=cycleway][moped=designated](bbox);node(w););out+skel;", "#5FFFFF", name="Cycleway Moped=designated (lichtblauw)"),
 make_layer("http://overpass-api.de/api/interpreter?data=node[highway=cycleway][moped=yes](bbox);out+skel;(way[highway=cycleway][moped=yes](bbox);node(w););out+skel;", "#5FFFFF", name="Cycleway Moped=yes (lichtblauw)"),
 

For example by using the OverpassAPI.

But he IS already using OverpassAPI! … or not?

That’s what I thought too. Any suggestions anyone or am I looking for the impossible?

Scai sent the link to the relevant point of documentation.

Please try


make_layer("http://overpass-api.de/api/interpreter?data=node[highway=cycleway][moped~"^designated$|^yes$"](bbox);out+skel;(way[highway=cycleway][moped~"^designated$|^yes$"](bbox);node(w););out+skel;", "#5FFFFF", name="Cycleway Moped=designated (lichtblauw)"),

This unifies both queries in a single query. In general, just move from [name=foo] or [name=bar] to [name~“^foo$|^bar$”]. The characters |^$ belong to the syntax of regular expressions and sum up to “or”.

I’ve tried it now with [moped][moped!=no] which is working as workaround, but not exactly the same. I also tried [moped~yes|designated] but this doesn’t work. Any ideas?

Edit: just saw Roland’s posting, will try [moped~“^designated$|^yes$”]

I’m sorry, I’ve forgotten to escape the double quotes:

make_layer("http://overpass-api.de/api/interpreter?data=node[highway=cycleway][moped~'^designated$|^yes$'](bbox);out+skel;(way[highway=cycleway][moped~'^designated$|^yes$'](bbox);node(w););out+skel;", "#5FFFFF", name="Cycleway Moped=designated (lichtblauw)"),

Thanks Roland, it’s working now. :slight_smile:

+1 :wink:

That’s true, I overlooked that :slight_smile:

How can I use wildcards in the key value?

For instance in the key [cycleway:*]=[value] see http://wiki.openstreetmap.org/wiki/Cycleway

  • can be :right :left or :both or :surface with a lot of other options after another :