This blog post is part of a series of blog posts about the new OSM file format “OMA”. This is the third post. At the end of the article you’ll find links to the other blog entries.
Until now you’ve got a general idea of what the Oma file format is, and an idea of how to use it. But you do not know, where to get an Oma file from.
Well, I hope, that sooner or later someone like Geofabrik will provide a daily updated planet.oma and some excerpts. That would make sense, because converting the data takes a lot of resources, and it would be a waste if everyone had to do it themselves.
But until we have such a distributor, you have to convert OSM files to Oma files on yourself. I have written a converter for this purpose. It’s written in Java and should be easy to use.
The Converter
You need a copy of oma.jar. If your are using Linux (or any other Unix operating system) you just have to type the following command:1
java -Xmx<some number>G -jar oma.jar <some osm file>
The -Xmx part tells the Java Virtual Machine to use <some number> gigabytes of memory. For example, my computer has got 4GB of main memory, so I’ll use -Xmx3G, reducing the available memory by 1GB, because the operating system needs some memory too.
The osm file mentioned in the command, can be one of .osm, .o5m or .pbf2.
Well, that’s about it. The program will read the file and start the conversion. This can take a long time, and hopefully it won’t crash.
Huh, crash? I wish I could give you better news, but unfortunately I have not been able to write a program that does never crash. The reason for this is that Java gives no guarantees or means of dealing with out-of-memory situations.3 So: If you have enough memory (and disk space), a crash should never happen, but if you have only limited memory, a crash might be possible.4




