OSM-binary/README.md

1.5 KiB

OSMPBF

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 .

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

Debian/Ubuntu Packages

To build the Debian/Ubuntu packages:

debuild -I -us -uc

To install the Debian/Ubuntu packages:

sudo dpkg --install ../libosmpbf-dev_*.deb
sudo dpkg --install ../libosmpbf-java_*.deb
sudo dpkg --install ../osmpbf-bin_*.deb

To clean up after:

debclean

License

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