# Host-side OSM ingest tools for the Maps offline packs. # # Replaces the former `scripts/maps/generator.cpp` (road graph) and # `scripts/maps/poi_extract.cpp` (POI layer), which needed g++ + libosmium and # therefore WSL, plus the `osmium tags-filter | osmium export | normalize_*.py` # chain that built the baked vector layers. This crate reads `.osm.pbf` natively, # so all three tools run on Windows. # # Deliberately DETACHED from the Android Rust workspace (the empty [workspace] # table below), exactly like `scripts/maps/gtfs_ingest`: it is a host binary, so # `cargo build` here never pulls the aarch64-android toolchain or the app crates' # lints. # # Both dependencies are pure Rust and no C toolchain is involved: # # miniz_oxide DECODE-ONLY inflate. We only ever decompress the zlib blobs # inside a .osm.pbf, so the deflate side is not needed here (unlike # tile_build, which writes gzip). # rayon the work-stealing pool behind the spatial sort and the graph # writer. Sized by `par::threads()`, so `--threads` and # `MAPS_THREADS` govern it rather than the whole box. # # `cargo build --offline` resolves both from the local registry cache, along with # rayon's own tree (rayon-core, crossbeam-deque, crossbeam-utils, crossbeam-epoch, # either). That is a statement about THIS box's cache, not a guarantee: a clean # machine needs one online `cargo fetch` before it can build offline. [package] name = "osm_ingest" version = "0.1.0" edition = "2021" publish = false license = "GPL-2.0-only" description = "OSM .osm.pbf -> Maps routing graph, POI side files and baked vector layers" [lib] name = "osm_ingest" path = "src/lib.rs" [[bin]] name = "road_graph" path = "src/bin/road_graph.rs" [[bin]] name = "road_overlay" path = "src/bin/road_overlay.rs" [[bin]] name = "poi_extract" path = "src/bin/poi_extract.rs" [[bin]] name = "osm_extract" path = "src/bin/osm_extract.rs" [dependencies] # Pure-Rust inflate. We only ever DECOMPRESS the zlib blobs inside a .osm.pbf, # so a decode-only crate is enough and keeps the C toolchain out of the build. miniz_oxide.workspace = true rayon.workspace = true # Pure Rust, one thin wrapper over the platform call, and no C toolchain — which is the bar every # other dependency here clears too. # # It backs `nodeloc`'s coordinate array with a file instead of the heap. That array is 8 bytes per # needed node, so 1.23 GB on a California extract, and it was half of `mamaps_build`'s whole peak. # Mapped, the resident cost is whatever the OS decides to keep, and the access pattern is friendly to # that: materialisation walks ways in id order and a way's nodes are close together in a PBF. memmap2.workspace = true # Blocked-section writer for the v7 graph (`tilecodec::blocked`, write side). # Host tool only — same pure-Rust bar as every other dependency here. tilecodec = { workspace = true, features = ["write"] } # `libc::statvfs` for the budget gate (`mem::disk_free_bytes`): already in the # lockfile via memmap2, so this adds a name to link, not a crate to fetch. [target.'cfg(target_os = "linux")'.dependencies] libc.workspace = true [profile.release] opt-level = 3