#osm-pbf #openstreetmap #osm #data-processing #utilities

rosm_pbf_reader

A low-level Rust library for parsing OpenStreetMap data in PBF format

3 stable releases

1.0.2 Mar 31, 2024
1.0.1 Nov 11, 2023
1.0.0 Feb 11, 2023

#980 in Parser implementations

Download history 7/week @ 2024-03-14 176/week @ 2024-03-28 18/week @ 2024-04-04 1/week @ 2024-05-23 4/week @ 2024-05-30

95 downloads per month

MIT license

32KB
582 lines

rosm_pbf_reader

Crates.io Docs.rs Build Status

A low-level Rust library for parsing OpenStreetMap data in PBF format.

This library provides the smallest possible API to work with OSM PBF files: a blob reader, a block parser and some utilities to read delta or densely encoded data. No other utilities are provided for further data processing (like filtering). There's also no built-in parallelization, however block parsing (which is the most computation-heavy part of the process) can be easily dispatched to multiple threads.

Features

Since most OSM PBFs are ZLib compressed, ZLib decompression support using flate2 is enabled by default. See Cargo's default feature documentation how to disable it.

The library provides a way for the user to support other compression methods by implementing the Decompressor trait.

Examples

  • print_header is a very simple example showing how to print the header block of an OSM PBF file.
  • count_wikidata is a more complete example showing multithreaded parsing, tag and dense node reading.

Similar projects

Dependencies

~0.5–2.3MB
~32K SLoC