[OSM-dev] Overpass API questions

Roland Olbricht roland.olbricht at gmx.de
Fri Apr 27 17:37:42 BST 2012


> Ignoring the relations:
> 
> (
>   way(35.40,-120.80,35.50,-120.00)[key!=value];
>   node(w);
> );
> out meta;
> 
> Now, the problem is how do I add standalone nodes (points of interest,
> etc.), since I only have ways?

You can just add another line with a bounding box for the nodes:

(
  way(35.40,-120.80,35.50,-120.00)[key!=value];
  node(w);
  node(35.40,-120.80,35.50,-120.00);
);
out meta;

The query within the parentheses are connected by "or". Thus, every additional 
request is just added to the result. In the same way

(
  way(35.40,-120.80,35.50,-120.00)[key!=value];
  node(w);
  node(35.40,-120.80,35.50,-120.00);
  rel(35.40,-120.80,35.50,-120.00);
  node(r)->.x;
  way(r);
  node(w);
);
out meta;

will add even the relations with the ways and nodes that they refer to.

> Another problem appears to be that [key!=value] filters out any way that
> does not have a key tag at all, in addition to those that have key=value,
> which is not what I need.

Yes, this has been the behaviour expected by design. The rationale behind this 
is to filter for "oneway" but not "oneway=no".

> *The point of this is to be able to eliminate ways and their nodes that
> account for up to 90% of the data being downloaded (i.e. inflating the data
> by 1000%) when they are unnecessary for a particular editing session.

However, this is a convincing argument. For this reason, and because the 
negation has not found widespread usage so far, I will change the semantics of 
"!=" in the very next version 0.6.98. Version 0.6.98 is scheduled to be 
released on Monday, 30 April.

This means, from 30 April on, you can get with the above query what you 
intended to get.
 
> 2. The example given at the top almost implements the normal API map call.
> However, the API map call returns the entire extent of ways that intersect
> the bbox, not just the nodes that fall within the bbox.

Yes, that's right. Both variants are used. It appears to depend on the client 
what behaviour is expected. Nonetheless, the above mentioned call does include 
the nodes for the entire way, even if the particular node is outside the 
bounding box.
 
Cheers,

Roland



More information about the dev mailing list