title: How to programmatically import OSM data with osmosis in Java?
body: <p>I've found the osmosis libs in maven 3 repository which I inserted into the pom.xml of my project.</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.openstreetmap.osmosis&lt;/groupId&gt;
          &lt;artifactId&gt;osmosis-core&lt;/artifactId&gt;
          &lt;version&gt;0.44.1&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>And now I try to import a *.osm.pbf data file into the PostGres / PostGIS database. The commentaries for the main method inside the Osmosis class says that you should write your own pipelines.</p>
  
  <p>Does anyone know a example how to implement a complete functionality for importing data?</p>
  
  <p>I've tried the Osmosis.run(args) method, but this seems not to accept my arguments.</p>
  
  <p><strong>Additional notes:</strong></p>
  
  <p>My approach looks like this so far:</p>
  
  <pre><code>   String args[] = { "--read-pbf file=" + DOWNLOAD_STUTTGART_PBF, "--log-progress",
                       "--write-pgsql host=\"localhost\" port=\"5432\"" + 
                       "database=\"myDatabase\" user=\"admin\" password=\"pw123\"" };
  
     Osmosis.run(args);
  </code></pre>
  
  <p>The output looks like this:</p>
  
  <pre><code>07:36:53.901 [main] INFO  o.j.p.standard.StandardPluginManager - plug-in started - org.openstreetmap.osmosis.core.plugin.Core@0.43.0.1-49-gb18e1e9-dirty-SNAPSHOT
  Okt 22, 2015 7:36:53 AM org.openstreetmap.osmosis.core.Osmosis run
  INFORMATION: Preparing pipeline.
  </code></pre>
  
  <p>No data is imported into the database. Unfortunately documentation is non existing, or I just cannot find the documentation.</p>