Using Osmosis in java project

Hi guys,

Despite the popularity of Osmosis, there seems to be a lack of documentation regarding its java API for developers who need to include it in their project. I am wondering if such documentation exists, and if not if someone can post some simple code examples. I found this thread:, but that code seems a bit outdated (e.g. the sink implementation now requires an initialize(Map<String, Object>) method).

Basically what I am trying to do is the following:

  1. Parse PBF files (so an example if PBF parsing similar to the XML one in the thread above will suffice) - in a highly multithreaded way if possible.
  2. Download and parse OSC (OSM change) files - hopefully in a similar pattern to the initial parsing.
  3. What dependencies do I need to add to my project. I am using Gradle and have added the following:
    compile ‘org.openstreetmap.osmosis:osmosis-core:0.44.1’
    compile ‘org.openstreetmap.osmosis:osmosis-xml:0.44.1’
    compile ‘org.openstreetmap.osmosis:osmosis-pbf:0.44.1’
    compile ‘org.openstreetmap.osmosis:osmosis-replication:0.44.1’
    compile ‘org.openstreetmap.osmosis:osmosis-pbf2:0.44.1’
    compile ‘org.openstreetmap.osmosis:osmosis-osm-binary:0.44.1’

Are these even the correct dependencies? I couldn’t find official documentation about adding Osmosis as a dependency in one’s project.

Also, I have a couple of questions:
4. Are there settings to configure how many threads Osmosis uses? Is Osmoses even multithreaded in parsing the files?
5. What about setting to configure the memory it uses, caching, etc.?
6. Is Osmosis capable of extracting only roads and junctions nodes (i.e. filter out nodes that are in the middle of ways and don’t represent intersections)?

Thank you for any help,

Hi Iulian, although I cannot answer any question of yours:

What about asking these special points on the osmosis-dev mailinglist or the more global “dev” mailinglist in the OSM universe?

See for details.

Aha, this is a good idea. I will do that. Thank you for the suggestion.