Osmpbf is a Java/C++ library to read and write OpenStreetMap PBF files.
PBF (Protocol buffer Binary Format) is a binary file format for OpenStreetMap
data that uses Google Protocol Buffers as low-level storage.
Note that this is a low-level library that does only part of the
encoding/decoding needed for actually writing/reading an OSM PBF file. For
something more complete see libosmium.
OSMPBF
https://github.com/openstreetmap/OSM-binary
Osmpbf is a Java/C++ library to read and write OpenStreetMap PBF files. PBF (Protocol buffer Binary Format) is a binary file format for OpenStreetMap data that uses Google Protocol Buffers as low-level storage.
For more information see https://wiki.openstreetmap.org/wiki/PBF_Format .
Note that this is a low-level library that does only part of the encoding/decoding needed for actually writing/reading an OSM PBF file. For something more complete see libosmium.
Java Version
Building with Maven
We publish the Java library to Maven Central:
To build the Java library run:
For a Java usage example, see
ReadFileTest
.Building with Ant
If you can not use Maven for some reason you can use the Ant instead:
This will build
osmpbf.jar
in the main directory.This build is also used for Debian packaging.
C++ Version
To compile:
To install:
There is a tool named osmpbf-outline that shows a debug output of the contents of a PBF file. To run it:
Using the C++ Library
To include in your program use:
and link with:
License
The .proto definition files and osmpbf.h are licensed under the MIT license. The other source code is licensed under the LGPL v3+.