Crates.io | osm-pbf |
lib.rs | osm-pbf |
version | 0.3.3 |
source | src |
created_at | 2023-03-27 02:58:23.277943 |
updated_at | 2023-05-23 21:11:30.904415 |
description | Read and write the OSM PBF Format |
homepage | https://github.com/sameer/osm-pbf |
repository | https://github.com/sameer/osm-pbf |
max_upload_size | |
id | 821638 |
size | 378,628 |
Read and write the PBF format for Open Street Map (OSM).
There are two steps to reading the PBF format: parsing and decoding. Parsing builds fileblocks out of the raw data. Decoding converts fileblocks into the OSM elements that they contain.
Similarly, there are two steps to writing the PBF format: encoding and serialization. Encoding converts OSM elements into fileblocks. This crate does not support encoding yet. Serialization flattens fileblocks into raw data.
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 locationsparse_osm_pbf_at_location
for each location independentlyWrite parallelization example:
write_osm_pbf
for each chunk independently with an in-memory vector as the writerThere is a feature for each supported compression algorithm:
Name | Default Feature | Supported |
---|---|---|
Zlib | ✅ | ✅ |
Zstd | ❌ | ✅ |
Lzma | ❌ | ✅ |
Lz4 | ❌ | ❌ |
Bzip2 | ❌ | ❌ |
Lz4 support is not available yet. Bzip2 has been deprecated for years so it is not supported.
There isn't any fine-grained control over encoding but feel free to file an issue if you are interested.