Parse and write the PBF format for Open Street Map (OSM).
There is a feature for each supported compression algorithm:
Name|Default Feature|Decode (read)|Encode (write) ---|---|---|--- Zlib|✅|✅|✅ Zstd|❌|✅|✅ Lzma|❌|✅|✅ Bzip2|❌|❌|❌ Lz4|❌|❌|❌
Bzip2 has been deprecated for years so it is not supported, Lz4 support is not available yet.
There isn't any fine-grained control over encoding but feel free to file an issue if you are interested.
This crate is written with async I/O for use with tokio.
The code is serial in nature but it's possible to parallelize encoding/decoding since fileblocks are independent in PBF.
Read parallelization example:
get_osm_pbf_locations
to get a stream of fileblock locations.parse_osm_pbf_from_locations
for each chunk independently (i.e. buffer_unordered).Write parallelization example:
write_osm_pbf
for each chunk independently (i.e. buffer_unordered) with an in-memory vector as the writer.