OSM2World/Using OSM2World as a library
|This documentation page is still under construction.|
OSM2World can be used as a library in Java programs running on a JVM. As always: If you need more functionality, don't understand the code, etc., just ask!
- Download OSM2World. The archive contains OSM2World and all libraries it depends on.
- Make sure that OSM2World.jar and its dependencies (the .jar files in the subdirectories of "lib") are in your class path.
- If you are going to use the OpenGL-related features of OSM2World, make sure that the native JOGL files for your platform are accessible when running your program. The files are in the
lib/jogl/directory. For a 64 bit Linux system, for example, you would call your program with a VM parameter like
This code snippet demonstrates the use of the
List<Target<?>> targets = new ArrayList<>(); targets.add(new POVRayTarget(out)); // output to POVRay targets.add(new ObjTarget(outOBJ, outMTL)); // output to OBJ targets.add(new JOGLTarget(gl, camera)); // output to OpenGL (uncached) targets.add(new PrimitiveBuffer()); // cached output ConversionFacade cf = new ConversionFacade(); // Results results = // if you want to work with some of the results directly cf.createRepresentations( osmFile, null, null, targets);