This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Efficient way to request two types of ways + relations from bounding box?

1

If I want to search for the ways and relations of highways and buildings within a bounding box, is this the most efficient way to write that query?

"[out:xml];(way[highway]({bbox});way[building]({bbox}););(._;>;);out;"

Or is there a more efficient way to specify the bounding box and the ways/relations I want within it? I'm using https://lz4.overpass-api.de/api/interpreter

Thanks for taking the time.

edit

To add some more context, we have an application where a user can toggle buildings, roads, railways...etc. So I need to be able to programatically peice together the query. So we get variations like:

"[out:xml];(way[railway]({bbox});way[building]({bbox}););(._;>;);out;"
"[out:xml];(way[highway]({bbox});way[building]({bbox}););(._;>;);out;"
"[out:xml];(way[building]({bbox}););(._;>;);out;"

asked 08 Jan '20, 20:35

kida001's gravatar image

kida001
31346
accept rate: 0%

edited 10 Jan '20, 14:08

TZorn's gravatar image

TZorn
12.3k764225

I think this is already the most efficient and most concise query. However I'm not an Overpass API expert.

(13 Jan '20, 13:41) scai ♦

Source code available on GitHub .