3

I'm trying to figure out if Overpass-API's bbox-query should be returning ways that:

  1. Are entirely enclosed by the box (all nodes are inside the box)
  2. Have at least one node inside the box.
  3. At least one segment intersects with the box (even if no nodes are actually inside it).

The docs suggest that it should do #3. http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Bounding_box_clauses_.28.22bbox_query.22.2C_.22bounding_box_filter.22.29

A way is found not only if it has a node inside the bounding box but also if it just crosses somewhere the bounding box.

But, in practice I'm seeing that it's basically only #1. Which is much less useful as that makes it difficult to make sure you've got all the ways which affect your bounding box.

O'Rooney
  • 2,878
  • 2
  • 27
  • 41

1 Answers1

1

I think I misunderstood. It does seem to return the ways that only intersect, ie #3, even if they have no nodes in the box. But I was confused because in my query I was also getting nodes and doing a union. It doesn't get the nodes for the way so Overpass-Turbo UI can't render the way. By recursing down, it gets the nodes as well and shows what I expect.

I was further confused because I was doing a query for relations as well, which finds many intersecting relations.

For example

<osm-script output="xml" timeout="25"><!-- fixed by auto repair -->
 <!-- gather results -->
 <union>
  <query type="way">
   <bbox-query w="-79.39941" s="43.64019" e="-79.39798" n="43.64120"/>
  </query>
  <query type="node">
   <bbox-query w="-79.39941" s="43.64019" e="-79.39798" n="43.64120"/>
  </query>
 </union>
 <union>
  <item/>
  <recurse type="down"/>
 </union>
 <!-- print results -->
 <print mode="meta" order="quadtile"/>
</osm-script>
O'Rooney
  • 2,878
  • 2
  • 27
  • 41
  • 1
    Why #1? According to your description it should be #3. BTW: Where did you get that XML from? It's a bit dated, and I wonder which instance of overpass turbo out there still produces this XML format. – mmd Oct 26 '16 at 20:46
  • This XML is a hodgepodge of my manual coding, output from the wizard on the Overpass Turbo website (http://overpass-turbo.eu/), and the union for recursion is from another stack overflow question. I found it very hard to find definitive documentation on the OSM XML script; the docs seem mostly structured around examples. – O'Rooney Oct 26 '16 at 22:35
  • I would be curious how you would write it to make it less dated. – O'Rooney Oct 26 '16 at 22:36
  • 1
    These days, overpass turbo wizard creates Overpass QL instead, which reads as: `[out:xml][timeout:25];(way(43.64019,-79.39941,43.64120,-79.39798);node(43.64019,-79.39941,43.64120,-79.39798););(._;>;);out meta qt;` Overpass XML is the older language variant, all recent tutorials are mostly "Overpass QL first". As documentation I only use http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL, all others are more or less incomplete or based on some examples as you noted. – mmd Oct 27 '16 at 07:32
  • Thanks for the information. The docs certainly seem a lot better. I guess I find QL pretty hard to read and much less explicit compared to the XML, so I've continued with it. – O'Rooney Oct 27 '16 at 20:06
  • 1
    BTW: In overpass turbo, you can also convert your query from one language variant to another via "Export" -> "Query" -> "Convert to....". – mmd Oct 27 '16 at 20:24