Need help with OSM-binary?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

148 Stars 60 Forks GNU Lesser General Public License v3.0 228 Commits 0 Opened issues

Services available


Need anything else?

Contributors list


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 .

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.

Github Actions C Build Status Github Actions Java Build Status

Java Version

Building with Maven

We publish the Java library to Maven Central:


To build the Java library run:

mvn package

For a Java usage example, see


Building with Ant

If you can not use Maven for some reason you can use the Ant instead:


This will build

in the main directory.

This build is also used for Debian packaging.

C++ Version

(Earlier versions used Makefiles for building. Please switch to the CMake-based build, the Makefiles are deprecated and will be removed in a future version.)

To compile:

mkdir build && cd build
cmake ..

To install:

make install

There is a tool named osmpbf-outline that shows a debug output of the contents of a PBF file. To run it:

tools/osmpbf-outline osm-file.osm.pbf

Using the C++ Library

To include in your program use:


and link with:

-pthread -lz -lprotobuf -losmpbf


The .proto definition files and osmpbf.h are licensed under the MIT license. The other source code is licensed under the LGPL v3+.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.