[osmosis-dev] TagFilter

Andrew Byrd andrew at fastmail.net
Tue Nov 24 12:13:48 GMT 2009


On 24 Nov 2009, at 12:24, Andrew Byrd wrote:

> 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.

OK, it does work... but you cannot use Tee and Merge tasks  
simultaneously:
  http://www.mail-archive.com/dev@openstreetmap.org/msg07991.html

The problem is that both inputs for the merge are coming from the same  
thread. It does deadlock (never finishes) if you use the tee-then- 
merge approach, I just tried it. One solution is to read the data in  
two separate tasks:

../osmosis/bin/osmosis \
--rx input.osm \
--tf reject-relations \
--tf accept-nodes amenity=* \
--tf reject-ways outPipe.0=POI \
\
--rx trimet.osm \
--tf reject-relations \
--tf accept-ways highway=motorway \
--used-node outPipe.0=motorway \
\
--merge inPipe.0=POI inPipe.1=motorway \
--wx test-merge.osm

The output file does seem to contain only motorways plus their nodes,  
and amenity nodes. The input file must be sorted for the merge to work  
right (it should be sorted if it comes from planet.osm, if not you can  
add a sort task.)

I am thinking about how to simplify the syntax, but the problem is  
that there is no such thing as an OSM highway node versus an amenity  
node, just nodes which can have any number of tags, so for now it's up  
to the Osmosis user to clearly state how the entity pipes are to be  
split and merged. I know the command line is long, but it shows in  
detail what's happening to your entities, which helps avoid unexpected  
results.

-Andrew



More information about the osmosis-dev mailing list