[osmosis-dev] call osmosis from groovy

Igor Podolskiy igor.podolskiy at vwi-stuttgart.de
Mon Sep 19 13:43:52 BST 2011


Hi Rüdiger,

> I found there is a run method in
> "org.openstreetmap.osmosis.core.Osmosis" but it doesn't work with the
> following code:
are you sure your code works with the main() method? Since main() is 
basically a wrapper around run() which just does System.exit(0) or 
System.exit(1) depending on whether there were exceptions or not, both 
run() and main() are equivalent in terms of classpath requirements, 
plugin initialization, etc.

AFAIK you don't need to add everything in lib/default to the classpath, 
classworlds will do it for you. Instead, your initial classpath should 
contain the classworlds jar, and then you need to set some magic system 
properties to point to the classworlds configuration (in the 
$OSMOSIS_HOME/config directory). Just look in the Osmosis startup script 
($OSMOSIS_HOME/bin/osmosis) and try to set up the environment (with 
System.setProperty() or the like) the same way in your Groovy script 
before calling run() - after all, you are "emulating" that startup shell 
script if you use Osmosis.run() or Osmosis.main().

Hope that helps
Igor



More information about the osmosis-dev mailing list