Question

I'm using the Overpass API to query OpenStreetMap for bus stops with a certain name near a specified location:

http://overpass-api.de/api/interpreter?data=[out:json];node["name"="CITY"];node["around"="15000"];node["name"="STOP_NAME"]["highway"="bus_stop"];out;

Now I need to expand this query: I don't only want get all bus stops named STOP_NAME near CITY, but also tram stops (railway=tram) and subway stops (railway=subway) matching STOP_NAME.

I tried this, but it still only returns bus stops (and includes redundant information):

http://overpass-api.de/api/interpreter?data=[out:json];node["name"="CITY"];(node(around:15000)["name"="STOP_NAME"]["highway"="bus_stop"];node(around:15000)["name"="STOP_NAME"]["railway"="tram_stop"];node(around:15000)["name"="STOP_NAME"]["railway"="subway_stop"];);(._;>;);out;

What am I doing wrong?

Was it helpful?

Solution

I solved this by including even more redundant information into the request URL: For each public transport type, I'm now repeating the "city node" and "around node".

I don't believe this is the best solution, but it's working well:

http://overpass-api.de/api/interpreter?data=[out:json];node["name"="CITY"];node(around:15000)["name"="STATION"]["highway"="bus_stop"];node["name"="CITY"];node(around:15000)["name"="STATION"]["railway"~"tram_stop|station|subway"];out;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top