Feed formats other than pbf to Osmosis

193 views Asked by At

I've written code in Java using the Osmosis framework and specifically OsmosisReader for Java, for OSM processing.

As far as I understand, OsmosisReader can only work with *.pbf files, which means I need to convert .osm files before using them (which I'm currently doing with osmconvert).

Is there a way to use other OSM formats with OsmosisReader? And if not, is there a way to convert the file format through the code (preferably with Osmosis)?

1

There are 1 answers

0
Tordanik On BEST ANSWER

The osmosis-xml package offers the XmlReader class. It can be used to read OSM data in XML-based formats (.osm, .osm.bz2 and .osm.gz).

Both OsmosisReader and XmlReader implement the RunnableSource interface, so you can go through that interface if you want your code to support multiple input formats.