[osmosis-dev] TagFilter
Andrew Byrd
andrew at fastmail.net
Tue Nov 24 11:24:29 GMT 2009
On 24 Nov 2009, at 11:32, Peter Körner wrote:
>
> Can I filter for nodes with a specific tag OR nodes in a way with a
> specific tag or does --used-node throw these POI nodes away?
>
> Eg. I want all nodes with the amenity tag set and all ways with the
> highway tag set plus their nodes.
It should be possible, but it's going to be a bit more complicated to
set up. The default behavior is to chain filters together in series,
so in your example you are keeping only highway=* in the ways
category, then keeping only amenity=* nodes ... so throwing away the
highway nodes before you even get to the used-node filter.
This default bahavior is inconvenient in your case, but I find it
consistent with the pipe/sink/source model in Osmosis. What you'd need
to do is split your input into two paths with the tee task, then merge
it back together.
1. read from xml
2. remove relations
3. split the stream of entities into two, A and B
4. keep only amenity nodes in stream A
5. keep only highway ways and their nodes in stream B
6. merge the two back together
7. write it all out to XML or whatever format
I haven't used the tee and merge tasks yet, but I'll post a message
when I get it working.
> an Example:
>
> osmosis \
> --read-xml input.osm \
> --tf accept-ways highway=* \
> --tf accept-nodes amenity=* \
> --tf reject-relations \
> --used-node \
> --write-xml output.osm
>
>
> Does --used-node in this case throw away all amenity=* nodes?
Yes. The used-node filter is the same one that was already in Osmosis.
This should eventually be changed, since I think it only works on ways.
-Andrew
More information about the osmosis-dev
mailing list