PeeWee32
(Peter )
November 5, 2012, 6:40pm
#1
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)"),
scai
(Alex)
November 5, 2012, 8:24pm
#2
For example by using the OverpassAPI .
stephan75
(stephan75)
November 6, 2012, 4:12pm
#3
But he IS already using OverpassAPI! … or not?
PeeWee32
(Peter )
November 6, 2012, 5:13pm
#4
That’s what I thought too. Any suggestions anyone or am I looking for the impossible?
drolbr
(Drolbr)
November 7, 2012, 8:32am
#5
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”.
ligfietser
(Ligfietser)
November 7, 2012, 8:32am
#6
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$”]
drolbr
(Drolbr)
November 7, 2012, 8:34am
#7
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)"),
ligfietser
(Ligfietser)
November 7, 2012, 8:42am
#8
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.
scai
(Alex)
November 14, 2012, 1:29pm
#10
That’s true, I overlooked that
ligfietser
(Ligfietser)
November 20, 2012, 1:42pm
#11
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 :