Go to file
Jochen Topf 32c3e92166 Update CI to run on Ubuntu 22.04 and 24.04 2025-06-11 11:07:09 +02:00
.github Update CI to run on Ubuntu 22.04 and 24.04 2025-06-11 11:07:09 +02: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 Remove Makefiles (have been deprecated a while) 2024-03-11 09:19:08 +01:00
.gitignore Modernize and clean up CMake configuration 2021-01-02 20:27:50 +01:00
CHANGELOG.md Release version 1.6.0 2024-12-10 08:20:09 +01:00
CMakeLists.txt Update CI to run on Ubuntu 22.04 and 24.04 2025-06-11 11:07:09 +02:00
LICENSE Rename COPYING.LESSER to LICENSE 2021-01-04 11:01:48 +01:00
README.md Modernize github actions 2024-03-11 09:26:22 +01:00
build.sh Remove symlink from osmpbf to src, use osmpbf directly 2022-05-27 12:36:32 +02:00
build.xml Revert "Delete obsolete Ant build file" 2021-01-09 09:47:02 +01:00
magic add magic file 2011-06-05 11:51:11 +02:00
pom.xml Don't wait for publishing 2024-12-10 08:48:05 +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:

<dependency>
  <groupId>org.openstreetmap.pbf</groupId>
  <artifactId>osmpbf</artifactId>
  <version>1.5.0</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+.