Modern Apps git

← Modern-Apps.git

mamaps: drop traffic z14 + boundaries z13, wash roads at z13

Commit
aa8d1d07d4b16b8071b3573e7bb1758dda42d906
Author
vayun-mathur <[email protected]>
When
2026-10-13 19:12 UTC (1 month ago)
Parents
0b06fa1
Phase 1: traffic MAX_ZOOM 14->13 (z13-only, overzoomed at z14; ids match
1:1, ribbon geometry stretches 2x - sub-pixel for a congestion overlay).
CA: traffic z14 gone entirely (~entire z14 traffic share).

Phase 3: boundaries MAX_ZOOM 13->12 (levels 5+ already min_zoom 12, so
county/city lines tile exactly one zoom; z13+ overzooms from z12).

Phase 2: roads + transit curves take the 1.5x wash below the archive max
(tolerance_for_layer); z14 policy is 0.0 so 1.5x of zero stays crisp
where carriageway/lane alignment lives.

CA gate (debug build, same inputs): total file 3.660 -> 3.452 GB
(-207.6 MB, -5.7%); z14 raw points -9.6M (-3.7%).

(analysis/mamaps_layer_sizes.py + mamaps_zoom_rollup.py leaf-inflate
fixes stay local - analysis/ is gitignored.)

Diff

scripts/maps/mamaps_build/src/schema/boundaries.rs
diff --git a/scripts/maps/mamaps_build/src/schema/boundaries.rs b/scripts/maps/mamaps_build/src/schema/boundaries.rsindex 78d1c6a3ec..896f54661c 100644--- a/scripts/maps/mamaps_build/src/schema/boundaries.rs+++ b/scripts/maps/mamaps_build/src/schema/boundaries.rs@@ -126,8 +126,9 @@ fn kind_for(level: u16) -> &'static str { /// How shallow a level is worth drawing. /// /// A country border carries a world tile. A city limit at z4 is noise — and there are a hundred-/// thousand of them. Levels 5+ start at z12: the zoom table showed boundaries at 15.3GB with-/// county/city lines retiled from z6/z9 up.+/// thousand of them. Levels 5+ start at z12, and the layer itself caps at z12+/// (`MAX_ZOOM_PER_LAYER`): county/city lines tile exactly one zoom, so the+/// z13 copies the old cap carried are gone and z13+ overzooms from z12. fn min_zoom_for(level: u16) -> u8 {     match level {         0..=2 => 0,
scripts/maps/mamaps_build/src/schema/mod.rs
diff --git a/scripts/maps/mamaps_build/src/schema/mod.rs b/scripts/maps/mamaps_build/src/schema/mod.rsindex f6251b6829..306d57c4f0 100644--- a/scripts/maps/mamaps_build/src/schema/mod.rs+++ b/scripts/maps/mamaps_build/src/schema/mod.rs@@ -155,20 +155,22 @@ pub fn detail(name: &str) -> u16 { /// The deepest zoom a layer is worth carrying at, by layer id. /// /// The `landtype` wash is no longer a low-zoom backdrop: it tiles to z14 at 1.0x sharpness, so-/// parks, shorelines and desert stay crisp under z14 roads and buildings. Boundaries keep-/// z13: lines carry sub-10m wiggles a 2x grid stretch could straighten, and 3GB buys keeping-/// them crisp. Every other layer tiles to the archive max (14). Enforced in the spill lane-/// filter beside `min_zoom`, so no spill format change: a per-layer table, not a per-feature-/// field.+/// parks, shorelines and desert stay crisp under z14 roads and buildings. Boundaries stop at+/// z12 (z13 overzooms from z12 exactly as z14 overzoomed z13 — admin lines soften one level,+/// nothing else moves). Traffic stops at z13: congestion ribbons overzoom legibly (the ids still+/// match 1:1, only the geometry stretches 2x — sub-pixel for a congestion overlay), and+/// z14 traffic was the layer's dominant cost. Every other layer tiles to the archive+/// max (14). Enforced in the spill lane filter beside `min_zoom`, so no spill format+/// change: a per-layer table, not a per-feature field. pub const MAX_ZOOM_PER_LAYER: [u8; 9] = [     14, // landtype     14, // roads-    13, // boundaries+    12, // boundaries (overzoomed at z13+)     14, // buildings     14, // places     14, // poi     14, // transit-    14, // traffic+    13, // traffic (overzoomed at z14; ids unaffected)     14, // junction ]; @@ -398,14 +400,16 @@ mod tests {         // streets); boundaries keep z13 (lines carry sub-10m wiggles a 2x stretch could         // straighten).         assert_eq!(max_zoom_for_layer(dict::LAYER_LANDTYPE), 14, "the wash is street detail");-        assert_eq!(max_zoom_for_layer(dict::LAYER_BOUNDARIES), 13, "lines keep z13");+        assert_eq!(max_zoom_for_layer(dict::LAYER_BOUNDARIES), 12, "lines overzoom past z12");+        // Traffic stops at z13 and overzooms at z14: congestion ribbons stretch 2x+        // (sub-pixel for an overlay) while the ids still match 1:1.+        assert_eq!(max_zoom_for_layer(dict::LAYER_TRAFFIC), 13, "traffic overzooms at z14");         for layer in [             dict::LAYER_ROADS,             dict::LAYER_BUILDINGS,             dict::LAYER_PLACES,             dict::LAYER_POI,             dict::LAYER_TRANSIT,-            dict::LAYER_TRAFFIC,             dict::LAYER_JUNCTION,         ] {             assert_eq!(max_zoom_for_layer(layer), 14, "layer {layer} is street detail");
scripts/maps/mamaps_build/src/tiler_part2.rs
diff --git a/scripts/maps/mamaps_build/src/tiler_part2.rs b/scripts/maps/mamaps_build/src/tiler_part2.rsindex 82cc0f6923..3ea23bb38f 100644--- a/scripts/maps/mamaps_build/src/tiler_part2.rs+++ b/scripts/maps/mamaps_build/src/tiler_part2.rs@@ -381,7 +381,10 @@ fn tile_chunk( /// `landtype` simplifies at 1.5x: natural boundaries (forest edges, shorelines, /// farmland) are washes, not navigation geometry — same reasoning as /// boundaries, smaller factor because parks and lakes are looked at closer.-/// Roads, buildings and the point layers keep 1.0 — navigation geometry and+/// Roads and transit curves take the wash below z14: at z13 a 1.5x tolerance+/// drops sub-10m wiggles (a 2x grid stretch could straighten them) while z14+/// stays at policy 0.0 — full detail where carriageway/lane alignment lives.+/// Buildings and the point layers keep 1.0 — navigation geometry and /// labels, not a wash. /// /// The prototype at `analysis/mamaps_building_savings.py` estimates this plus the snap below at@@ -396,6 +399,12 @@ fn tolerance_for_layer(layer: u8, z: u8, tolerance: f64) -> f64 {         tolerance * WASH_SIMPLIFICATION     } else if layer == dict::LAYER_LANDTYPE {         tolerance * LANDTYPE_SIMPLIFICATION+    } else if z < crate::DEFAULT_MAX_ZOOM+        && (layer == dict::LAYER_ROADS || layer == dict::LAYER_TRANSIT)+    {+        // Below the archive max the policy tolerance is non-zero, so the wash+        // bites; at z14 policy is 0.0 and 1.5x of zero is zero — crisp.+        tolerance * WASH_SIMPLIFICATION     } else {         tolerance     }
scripts/maps/mamaps_build/src/tiler_part7.rs
diff --git a/scripts/maps/mamaps_build/src/tiler_part7.rs b/scripts/maps/mamaps_build/src/tiler_part7.rsindex d062cfbe06..fad1d9195c 100644--- a/scripts/maps/mamaps_build/src/tiler_part7.rs+++ b/scripts/maps/mamaps_build/src/tiler_part7.rs@@ -188,8 +188,11 @@ mod tests {         // And below the buildings floor the policy stands: z13 keeps 1.0, not 0.5.         assert_eq!(tolerance_for_layer(dict::LAYER_BUILDINGS, 13, 1.0), 1.0);         assert_eq!(tolerance_for_layer(dict::LAYER_LANDTYPE, 13, 1.0), 1.5, "the landtype wash scales the policy");-        assert_eq!(tolerance_for_layer(dict::LAYER_ROADS, 13, 1.0), 1.0, "roads keep policy");-        assert_eq!(tolerance_for_layer(dict::LAYER_ROADS, 13, 1.0), 1.0, "roads keep policy");+        // Roads take the wash below the archive max (z13 1.5x); at z14 policy+        // is 0.0 and the wash is a no-op — crisp where lanes align.+        assert_eq!(tolerance_for_layer(dict::LAYER_ROADS, 13, 1.0), 1.5, "roads wash below max zoom");+        assert_eq!(tolerance_for_layer(dict::LAYER_ROADS, 14, 0.0), 0.0, "roads crisp at max zoom");+        assert_eq!(tolerance_for_layer(dict::LAYER_TRANSIT, 13, 1.0), 1.5, "transit curves wash below max zoom");         assert_eq!(tolerance_for_layer(dict::LAYER_BOUNDARIES, 10, 2.0), 3.0, "the boundary wash scales the policy");     } @@ -300,10 +303,11 @@ mod tests {             carriageway: tilecodec::mamaps::body::Carriageway::default(),         };         let (bytes, _) = build(&spilled(&[road]), &settings(14, 14)).expect("build");-        // The reader's own version byte, so an older reader rejects the archive cleanly.+        // The writer's own version byte, so an older reader rejects the archive cleanly.+        // v9: leaves compress by default, which the v8 byte cannot name.         assert_eq!(             bytes[7],-            tilecodec::mamaps::header::FORMAT_VERSION,+            tilecodec::mamaps::header::FORMAT_VERSION_V9,             "the archive header carries the writer's own format version",         );         let entries = tilecodec::mamaps::read::read_all(&bytes).expect("read");@@ -351,9 +355,10 @@ mod tests {             carriageway: tilecodec::mamaps::body::Carriageway::default(),         };         let (bytes, _) = build(&spilled(&[building]), &settings(14, 14)).expect("build");+        // v9: leaves compress by default, which the v8 byte cannot name.         assert_eq!(             bytes[7],-            tilecodec::mamaps::header::FORMAT_VERSION,+            tilecodec::mamaps::header::FORMAT_VERSION_V9,             "the archive header carries the writer's own format version",         );         let entries = tilecodec::mamaps::read::read_all(&bytes).expect("read");@@ -512,9 +517,10 @@ mod tests {             crate::dem::Dem::from_grids(z, dim, vec![(tile_id(z, tx, ty), grid.clone())]);         let with_dem = Settings { dem, ..settings(14, 14) };         let (bytes, _) = build(&spilled(&[building()]), &with_dem).expect("build with dem");+        // v9: leaves compress by default, which the v8 byte cannot name.         assert_eq!(             bytes[7],-            tilecodec::mamaps::header::FORMAT_VERSION,+            tilecodec::mamaps::header::FORMAT_VERSION_V9,             "the archive header carries the writer's own format version",         );         let entries = tilecodec::mamaps::read::read_all(&bytes).expect("read");