Problem with OSMOSIS merge Command

Hi all,

I have spent the last hour tring to get a merge working. Similar to the example here:

http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage#–tag-filter_.28–tf.29

I am using the following command:

My error is:

Thread for task 1-rx failed
java.lang.LinkageError: loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm): attempted duplicate class definition for name: “org/apache/xerces/jaxp/datatype/DatatypeFactoryImpl”

However the following command works (which makes me think that there is problem reading two xml files)

I also tried a --tee but I got deadlock like the documentation suggested would happen :slight_smile:

Any ideas would be much appreciated.

Thanks,
Rob

Issue resolved…

You have to use separate commands and intermediate files. (and make sure you sort first)


sh osmosis \
  --rx output/London.osm.xml \
  --tf reject-relations \
  --tf accept-ways lcn_ref=* \
  --used-node \
  --sort \
  --wx output/lcn.osm.xml
sh osmosis \
  --rx output/London.osm.xml \
  --tf reject-relations \
  --tf accept-ways ncn_ref=* \
  --used-node \
  --sort \
  --wx output/ncn.osm.xml
sh osmosis \
  --rx output/ncn.osm.xml \
  --rx output/lcn.osm.xml \
  --merge \
  --wx output/merged.osm.xml

https://trac.openstreetmap.org/ticket/3840

In case this doesn’t work out, this task could be accomplished with osmfilter as well.