OSM XML -> Java Objects

What’s the easiest way to get a Java object representation of an OSM XML file?
I need a simple API where I have read access to all nodes and ways and their properties.

I’ve read about Osmosis, but I couldn’t figure out how to actually get the object structure in java, rather than transforming the data to some other format I have no use for :wink:
And I’ve found this little library here: osm-parser, which comes pretty close to what I am looking for, but when I had a look at the code… it just doesn’t look very mature.

So, any suggestions?

one entry point for more research can be http://wiki.openstreetmap.org/wiki/Frameworks

or http://wiki.openstreetmap.org/wiki/OSM_XML

Or search for the android app Osmand … it has a mapcreator program written in Java to run it on a PC … it loads raw OSM data and creates offline vector maps for use in the android app.

Osmand’s mapcreator is opensource.

Did you find this?


I think you need to implement another interface method in the sink that has been added since then, but the basics should still be correct.

Yeah, I did, but I didn’t like the solution too much. The minimum dependency for this is osmosis-xml, which itself depends on osmosis-core, some apache commons librarys, stax, xerces, … which adds full 3MB in weight to my release.

Anyway, now that I’ve tried, it works like a charm, so I guess I’m gonna live with the overhead for now.
Please, let me know if there is a more minimalistic solution!