Skip to main content

Module h3

Module h3 

Source
Available on crate features cells3d and raster only.
Expand description

h3o u64 boundary (PHASE-R-MAP §4 / divergence D7): all bitwise spatial algebra for the raster crate lives here, never leaking into graph semantics. CellIndex (u64-backed NonZeroU64) is the spatial index domain type end-to-end; it is stringified only when it crosses the graph’s stringly-typed ID boundary. Feature-gated cells3d. Task 9.

Structs§

Extensives
Extensive (summable) quantities carried per grid cell (aggregateCells, topology-deck.html:371-380): c, v, s, t (transformation transfer), and n (member count) all sum under aggregation; hx/hz (ground position) sum too, then are divided by n at the call site to recover the mean position (mirrors the deck’s hx/=n; hz/=n).

Functions§

aggregate_by_parent
GROUP BY parent(h3_index) (Deviation 7): coarse-grains cells — each (CellIndex, Extensives) pair rolls up to parent(coarse_res), extensives summed. Output order is the order each parent is FIRST encountered while scanning cells (deterministic, independent of any hash order — no HashMap iteration order leaks into the returned Vec). Bounded: cells.len() iterations, cells.len() worst-case output rows.
industry_cell
Snap an industry’s axial (hq, hr) offset to a real h3o::CellIndex, anchored at origin — the inverse of to_local_ij (Finding 10): CellIndex::try_from(LocalIJ::new(origin, CoordIJ::new(hq, hr))). Returns Err(LocalIjError::Pentagon) explicitly when the offset crosses pentagon distortion (12 of 122 base cells are pentagons) — callers MUST handle it, never .unwrap() (Power-of-10 rule 4).
origin_cell
A fixed, deterministic origin cell for the deck’s invariant industry hex grid, at resolution. The deck’s own grid (topology-deck.html:169-172) is a synthetic axial-coordinate mock with no geographic meaning; h3o requires a real anchor, so (0,0) lat/lng is used — arbitrary but fixed, making every industry_cell call a pure function of (hq,hr).