Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions crates/cockpit-server/src/osm_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1179,17 +1179,6 @@ fn simplify_cells_raw(
out
}

/// The lon/lat projection of [`simplify_cells_raw`] — the JSON wire's view.
fn simplify_cells(chain: &[osm_soa_bake::tms::TileXy], z: u32) -> Vec<[f64; 2]> {
simplify_cells_raw(chain, z)
.into_iter()
.map(|c| {
let (lon, lat) = osm_soa_bake::tms::tile_to_lonlat(c.x, c.y_xyz);
[lon, lat]
})
.collect()
}

/// Geometry is far heavier per row than a dot, so it gets its own ceiling
/// rather than reusing [`row_budget`]. Same zoom split and same reasoning as
/// there: decimating an overview is a legitimate LOD choice, decimating a city
Expand Down Expand Up @@ -1998,6 +1987,22 @@ mod tests {
.collect()
}

/// Test-only convenience: the lon/lat projection of [`simplify_cells_raw`],
/// so the assertions below can compare degrees directly instead of
/// re-deriving `tile_to_lonlat` at every call site. Production code
/// projects `simplify_cells_raw`'s output inline (`query_tile_geometry`
/// for JSON, `encode_tile_bin` for the binary wire) — this wrapper has no
/// production caller of its own.
fn simplify_cells(chain: &[osm_soa_bake::tms::TileXy], z: u32) -> Vec<[f64; 2]> {
simplify_cells_raw(chain, z)
.into_iter()
.map(|c| {
let (lon, lat) = osm_soa_bake::tms::tile_to_lonlat(c.x, c.y_xyz);
[lon, lat]
})
.collect()
}

#[test]
fn class_for_tags_applies_precedence_not_first_match() {
// Each rule fires on its own…
Expand Down