Go to file
Jochen Topf 5b6d2afa9c Use C++ versions of headers 2026-07-24 14:53:28 +02:00
.github CI: Fix macOS build 2025-12-03 09:20:32 +01:00
include/osmpbf Set shared library version and bump version number to 1.5.0 2021-01-03 16:50:22 +01:00
osmpbf Remove trailing newlines from proto files 2024-09-29 07:35:19 +02:00
resources Convert WriteFileTest to unit test 2021-01-03 20:29:25 +01:00
src.java/crosby/binary Extract and make CompressFlags public 2024-01-07 11:44:09 +01:00
test.java/crosby/binary ReadFileTest: get rid of StringBuilder 2021-01-03 20:37:12 +01:00
tools Use C++ versions of headers 2026-07-24 14:53:28 +02:00
.gitignore Modernize and clean up CMake configuration 2021-01-02 20:27:50 +01:00
CHANGELOG.md Add changelog 2025-12-20 09:46:06 +01:00
CMakeLists.txt CMake config: Enable generation of compile_commands.json 2026-07-24 14:51:49 +02:00
LICENSE Rename COPYING.LESSER to LICENSE 2021-01-04 11:01:48 +01:00
README.md Add badges for Java 2025-12-20 09:51:03 +01:00
build.sh Remove symlink from osmpbf to src, use osmpbf directly 2022-05-27 12:36:32 +02:00
build.xml Set Java version to 1.8 to match Maven build. 2026-03-10 19:38:12 +01:00
magic add magic file 2011-06-05 11:51:11 +02:00
pom.xml Bump version to 1.6.1 2025-12-20 10:45:14 +01:00

README.md

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.

Github Actions C++ CI Github Actions Java CI Packaging status

Java Version

Building with Maven

We publish the Java library to Maven Central: Maven Central

<dependency>
  <groupId>org.openstreetmap.pbf</groupId>
  <artifactId>osmpbf</artifactId>
  <version>${LATEST_VERSION}</version>
</dependency>

To build the Java library run:

mvn package

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:

ant

This will build osmpbf.jar in the main directory.

This build is also used for Debian packaging.

C++ Version

To compile:

mkdir build && cd build
cmake ..
make

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:

#include <osmpbf/osmpbf.h>

and link with:

-pthread -lz -lprotobuf -losmpbf

License

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