#pbf #openstreetmap #geocoding #osm

pbf-reader

Fast openstreetmap PBF file format reader. Reads Nodes, Ways, Relations. It uses mpsc::channell and multiple threads to do job as fast as possible.

9 releases

Uses old Rust 2015

0.1.9 Sep 5, 2019
0.1.8 Nov 26, 2018
0.1.7 Oct 18, 2018
0.1.4 Jan 2, 2018
0.0.4 Feb 22, 2016

#153 in Geospatial

Download history 4/week @ 2023-11-02 5/week @ 2023-11-09 2/week @ 2023-11-16 20/week @ 2023-11-23 32/week @ 2023-11-30 10/week @ 2023-12-07 10/week @ 2023-12-14 19/week @ 2023-12-21 2/week @ 2023-12-28 18/week @ 2024-01-04 21/week @ 2024-01-18 11/week @ 2024-01-25 10/week @ 2024-02-01 14/week @ 2024-02-08 99/week @ 2024-02-15

134 downloads per month

Custom license

45KB
1K SLoC

Simple Openstreetmap PBF file format reader. http://wiki.openstreetmap.org/wiki/PBF_Format

pipeline status

This lib uses multithreaded approach for reading data and optimized for speed :D.

Serial read can be achieved by restricting number of additional concurent threads to 0.

For example usate see src/lib.rs tests. There is GUI example which can be run using cargo run --release --example paint

DONE:

  • reading Nodes, Ways, Relatons, Tags

TODO:

  • build index for faster read access.
  • filtered read.
  • documentation and examples.
  • template float and ID types for tunable storage precision.

*** Thanks Gitlab.com team for allowing editing this file online!

Principle #1 User can't catch more than ~5mb of text+vector data from a 4"-6" screen.


lib.rs:

The pbf-reader crate provides function to parse pbf osm format http://wiki.openstreetmap.org/wiki/PBF_Format extern crate pbf_reader; use *; use std::sync::mpsc; // create communication channel let (mut node_tx, node_rx) = mpsc::channel::(); // start read in background thread let h = thread::spawn(move || { // allow usage of 4 additional threads to current one. let threads = 4; let result = read_pbf(&"src/sample.pbf".to_string(), threads, &mut node_tx); result.unwrap(); }); let mut count = 0; loop { if let PBFData::ParseEnd = node_rx.recv().unwrap() { break; } count = count + 1; } assert_eq!(count, 338); h.join().unwrap();

Dependencies

~1.5–3MB
~50K SLoC