Take a look at the code for my XAPI servlet:

https://github.com/iandees/xapi-servlet/blob/master/src/main/java/com/yellowbkpk/geo/xapi/servlet/XapiServlet.java

There's a lot of HTTP and XAPI-related stuff in there, but the Osmosis 
classes are there:
Line 130 and the "makeRequestIterator()" method create a data source 
(querying the database)
Line 153 creates a data sink (a data output mechanism)
Line 162 and 164 process the data into the sink. (writes XML to the client)

On Wednesday, June 29, 2011 9:51:14 AM UTC-5, Robert Greil wrote:
>
> 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
>
> _______________________________________________
> dev mailing list
> d...@openstreetmap.org
> http://lists.openstreetmap.org/listinfo/dev
>
>
_______________________________________________
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev

Reply via email to