[OSM-dev] Overpass API questions
Alan Mintz
Alan_Mintz+OSM at Earthlink.Net
Thu Apr 26 20:34:40 BST 2012
I have 2 questions about how to use the Overpass API.
This is given as the equivalent of the "map" API calls:
(
node(35.40,-120.80,35.50,-120.00);
rel(bn)->.x;
way(bn);
rel(bw);
);
out meta;
1. I want to add a "filter" to eliminate certain _ways_ that I am not
interested in*. I was able to add [key!=value] to the end of the bbox
element to filter out _nodes_ with a certain tag:
node(35.40,-120.80,35.50,-120.00)[key!=value];
Assuming that way(bn) adds the ways for all the nodes, I tried moving the
filter there:
way(bn)[key!=value];
This _almost_ works. It, indeed, removes ways where key=value. However, it
still includes all the (now orphaned) nodes that made up those ways.
It therefore seemed that what I wanted to do is, instead of starting with
nodes, get ways (filtering out ones I don't want), then get their nodes.
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?
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. I need to filter out only those ways with
key=value, and leave in any that have key=something_else or no key= tag at all.
So - I want the normal results, without ways that have a certain key=value,
and without those ways' nodes.
*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.
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. It seems that the
example needs to add all nodes for all ways, once all ways are added:
(
node(35.40,-120.80,35.50,-120.00);
rel(bn)->.x;
way(bn);
node(w);
rel(bw);
);
out meta;
This seems to yield the same result as a download from JOSM as far as count
of nodes and ways, except that the relations are missing. What happened?
--
Alan Mintz <Alan_Mintz+OSM at Earthlink.net>
More information about the dev
mailing list