[OSM-dev] How to use osmosis as a lib with direct access to the classes?
Robert Greil
greil at in.tum.de
Wed Jun 29 15:51:14 BST 2011
Hi!
I am currently trying to use OSMOSIS as a lib for our java project. I
have already checked out the svn repository and downloaded the latest
osmosis zip from the website. I included all *.jar found in the
Osmosis/lib directory as libs for our java project because of the
dependencies between the jars.
I want to use the example command line argument 'osmosis --read-pbf
file="data_in.osm.pbf" --bounding-box left="90" right="90" --write-xml
file="data_out.osm"' with direct access to the corresponding classes
inside the java project.
I think I have identified the jars I need for that:
osmosis-pbf-0.39.jar - command: --read-pbf file="data_in.osm.pbf"
osmosis-areafilter-0.39.jar - command: --bounding-box left="90" right="90"
osmosis-xml-0.39.jar - command: --write-xml file="data_out.osm"
I had a look inside the source code from the svn to see how to call
theses classes directly without using the commandline parsing and
pipeline and so on. I am not sure which classes are the correct ones,
but according to the TaskFactories I tried using these:
crosby.binary.osmosis.OsmosisReader
org.openstreetmap.osmosis.areafilter.v0_6.BoundingBoxFilter
org.openstreetmap.osmosis.xml.v0_6.XmlWriter.
But I am really struck on how to access them directly or how to create
and connect their input and outputstreams. I also do not know how to
call the OsmosisReader directly, because it is set to protected and
therefore not accessable from outside the package. I spent already hours
coding and failing and slowly I am feeling like I am doing it the
completely wrong way.
That is why I am asking here, if anybody has done something similiar in
the past (and point me to an example) or if anybody can give me a hint
in the right direction or maybe some simple code examples/snipplets.
Any help would be greatly appreciated!
Thanks,
Robert
More information about the dev
mailing list