[osmosis-dev] question about --merge

Andrew Byrd andrew at fastmail.net
Wed May 19 13:04:21 BST 2010


Hello,

On 19 May 2010, at 13:42, Brett Henderson wrote:
> The --tag-filter task is about the most comprehensive task currently  
> available.  To add a full boolean expression language is certainly  
> possible, but not trivial.  If somebody wants to take on the  
> challenge of creating a complex yet generic tag analysis task then  
> I'll do my best to help them out.  I'll be honest though, it's not  
> likely to be something I'll get around to implementing myself.

Part of the challenge is that tags and values can contain any  
character, so your expressions get cluttered with escape sequences,  
and also must pass through the shell.

Another issue is running a used-node filter that would 'know' not to  
delete the non-way nodes that you want. It's pretty complicated to  
unambiguously specify this kind of behaviour, unless the used-node  
filter is integrated into the tagfilter.

I'm still open to tagfilter syntax and functionality suggestions. You  
can do many different things with the current version, but you have to  
spell it all out explicitly on the command line, which I don't  
necessarily consider a bad thing.

> Thinking about your case a bit more, you could avoid the temp file  
> if you simply read the input file twice so you avoid the --tee.   
> Although that might be slower than creating a temp file and invoking  
> Osmosis twice.  If it was me I'd simply create a wrapper shell  
> script to tie several osmosis commands together and do some checking  
> of the Osmosis return code to ensure it hasn't failed at each step.   
> The --buffer approach might work, but the memory consumption is  
> likely to bite you at some point.

This is the solution I came up with too. I didn't notice any  
significant slowdown with this approach on a city-sized OSM file. I'm  
re-including the example command I gave before, because I messed up a  
parameter the last time:

./osmosis/bin/osmosis \
--rx input.osm \
--tf reject-relations \
--tf accept-nodes amenity=* \
--tf reject-ways outPipe.0=POI \
\
--rx input.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 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.)

-Andrew Byrd




More information about the osmosis-dev mailing list