Flat file node cache stores lat,lon coordinate pairs as u64
values with their index being the position in the file. In
other words - 0th u64 value is stored as the first 8 bytes, etc.
The library allows multithreaded access to the cache, and can dynamically grow the cache file.
```rust,no_run // This example uses osmpbf crate use std::path::PathBuf; use rayon::iter::{ParallelBridge, ParallelIterator}; use osmnodecache::{DenseFileCache, CacheStore as _}; use osmpbf::{BlobReader, BlobDecode};
fn main() { let reader = BlobReader::frompath("planet.osm.pbf").unwrap(); let filecache = DenseFileCache::new(PathBuf::from("node.cache")).unwrap();
reader.parbridge().foreachwith( filecache, |fc, blob| { let mut cache = fc.getaccessor(); if let BlobDecode::OsmData(block) = blob.unwrap().decode().unwrap() { for node in block.groups().flatmap(|g| g.densenodes()) { cache.setlat_lon(node.id as usize, node.lat(), node.lon()); } }; }); } ```
make
. Install it with cargo install just
.just
.just test
.git push
, it will run a few validations, including cargo fmt
, cargo clippy
, and cargo test
. Use git push --no-verify
to skip these checks.Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.