OSM PBF header information


I have a directory full of osm.pbf files that I need to extract metadata from, specifically the bounding box stored in the file. I also need to use the Java programming language.

Does anyone know how to do that in Java, I’ve been looking all afternoon. While I understand that the file format, at its core, uses Google Protocol Buffers I’ve not seen anything that identifies how to extract a metadata record or at the very least the bounding box for the file.

What I’m hoping is that somewhere in the pbf data file is a header, which will have the information it. And that there is a convenient Java library to use to get it.

Any thoughts more than welcome.

With thanks.


Hmm…maybe take a look at code of mkgmap splitter

… also have a look at JOSM and Osmand (at least its MapCreator for Desktop PC) … they are java apps and opensource and do pbf processing.

If you still get stuck also aks at the OSM mailing list about Developing : http://wiki.openstreetmap.org/wiki/Mailing_lists


I was able to look at the source code for a number of applications and
have developed a small application [1] that outputs the information
that I need.

Many thanks for your help.


[1] https://github.com/servalproject/ServalMapsUtils/tree/master/OsmPbfMetadata