Hi

just by looking at the code
>https://github.com/openstreetmap/osmosis/blob/master/osmosis-set/src/main/java/org/openstreetmap/osmosis/set/v0_6/EntityMerger.java?source=cc>

it looks like instanciating your EntityMerger creates two internal sinks (sortedEntityValidator0 and sortedEntityValidator1) which are queried for data. It looks like you can access them using getSink(0) and getSink(1).

So I'd guess you could do sth. like this:

XmlReader xmlReader0 = new XmlReader(inputFile0, true,
  CompressionMethod.None);
XmlReader xmlReader1 = new XmlReader(inputFile1, true,
  CompressionMethod.None);

EntityMerger merger = new EntityMerger(
  ConflictResolutionMethod.Timestamp, 1000, BoundRemovedAction.Ignore);

xmlReader0.setSink(merger.getSink(0));
xmlReader1.setSink(merger.getSink(1));

MyOwnSink mySink = new MyOwnSink(...);
merger.setSink(mySink);

xmlReader0.run();
xmlReader1.run();



The question is: will xmlReader0.run() block or not? If it blocks, you'd probably have to start two threads and run one xmlReader per thread, joining them back when both are finished.

Lg, Peter



Am 28.05.2013 16:13, schrieb Richard Redweik:
Hi list,

I am trying to implement my own process to read osm data. Therefore I am
using the osmosis jars from the maven repository.

Currently I am connecting my tasks by hand. For example:

XmlReader xmlReader = new XmlReader(inputFile, true,
CompressionMethod.None);
PolygonFilter polygonFilter = new PolygonFilter(IdTrackerType.Dynamic,
polygonInputFile, false, false, false, false);
xmlReader.setSink(polygonFilter);
MyOwnSink mySink = new MyOwnSink(...);
polygonFilter.setSink(mySink);
xmlReader.run();

Here MyOwnSink is a Sink written by myself.
This works as expected.

Now I want to read two OSM files and merge them with the EntityMerger.
But I do not know how to let the EntityMerger know about the two OSM files.
Calling xmlReader.setSink(merger) is not possible since EntityMerger is
no Sink, but a MultiSink.

Does someone know, how to use the EntityMerger with two or multiple OSM
files?
Can I add the EntityMerger into my workflow, which I described above?

Thanks in advance,
Richard


_______________________________________________
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev



_______________________________________________
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev

Reply via email to