Go to file
Jochen Topf 218bfe8ed8 Add optional LZ4 and ZSTD compressed data blocks to proto file 2021-01-03 16:45:26 +01:00
.github Update Github actions: Use cmake to build, add macOS and Windows 2021-01-02 20:28:25 +01:00
include/osmpbf License the .proto and header files under MIT 2019-07-11 13:59:00 -07:00
resources Java file read demonstration, to help people getting started. 2012-10-19 23:00:21 +01:00
src Add optional LZ4 and ZSTD compressed data blocks to proto file 2021-01-03 16:45:26 +01:00
src.java/crosby/binary Fix line endings (CRLF->LF), remove spaces at end of lines 2013-09-02 20:44:02 +02:00
tools Set destination for installs explicitly 2021-01-03 15:26:14 +01:00
.gitignore Modernize and clean up CMake configuration 2021-01-02 20:27:50 +01:00
CHANGELOG.md CHANGELOG: include changes since version 1.3.3 2020-10-26 07:47:44 +01:00
CMakeLists.txt Use the GNUInstallDirs module to set installation directories 2021-01-03 11:01:48 +00:00
COPYING Include GPLv3 text 2015-06-23 17:08:59 +01:00
COPYING.LESSER Include GPLv3 text 2015-06-23 17:08:59 +01:00
README.md This is really a C++ library, not C 2021-01-02 20:59:46 +01:00
magic add magic file 2011-06-05 11:51:11 +02:00
osmpbf Modernize and clean up CMake configuration 2021-01-02 20:27:50 +01:00
pom.xml Deploy to Maven Central 2020-10-20 01:27:44 +02: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 Build Status Github Actions Java Build Status

Java Version

We publish the Java library to Maven Central:

<dependency>
  <groupId>org.openstreetmap.pbf</groupId>
  <artifactId>osmpbf</artifactId>
  <version>1.4.0</version>
</dependency>

To build the Java library run:

mvn package

For a Java usage example, see src.java/crosby/binary/test/ReadFileExample.java

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+.