first commit

This commit is contained in:
dongho
2024-08-30 22:51:49 +09:00
commit c6bb80ee5c
5 changed files with 520 additions and 0 deletions

29
src/main.rs Normal file
View File

@ -0,0 +1,29 @@
use osmpbf::*;
fn main() {
let reader = ElementReader::from_path(
"/mnt/c/Users/dongho/Desktop/ekstrahMap/assets/south-korea-latest.osm.pbf",
);
println!("Counting...");
match reader.expect("REASON").par_map_reduce(
|element| match element {
Element::Node(_) | Element::DenseNode(_) => (1, 0, 0),
Element::Way(_) => (0, 1, 0),
Element::Relation(_) => (0, 0, 1),
},
|| (0u64, 0u64, 0u64),
|a, b| (a.0 + b.0, a.1 + b.1, a.2 + b.2),
) {
Ok((nodes, ways, relations)) => {
println!("Nodes: {nodes}");
println!("Ways: {ways}");
println!("Relations: {relations}");
}
Err(e) => {
println!("{e}");
std::process::exit(1);
}
}
}