Modern Apps git

← Modern-Apps.git

mamaps: drop sub-2px building footprints

Commit
011aad2c4b37c3a26d6095cc7232ab57fe57f323
Author
vayun-mathur <[email protected]>
When
2026-10-10 03:59 UTC (1 month ago)
Parents
9eafebe

Diff

scripts/maps/mamaps_build/src/schema/buildings.rs
diff --git a/scripts/maps/mamaps_build/src/schema/buildings.rs b/scripts/maps/mamaps_build/src/schema/buildings.rsindex 65c02cba8e..b5568f1b8f 100644--- a/scripts/maps/mamaps_build/src/schema/buildings.rs+++ b/scripts/maps/mamaps_build/src/schema/buildings.rs@@ -55,18 +55,19 @@ pub const MIN_ZOOM: u8 = 14;  /// The smallest drawn building footprint worth carrying, in square pixels of a 256-unit tile. ///-/// `1.0`: a footprint smaller than one display pixel at z14. Converted by-/// [`super::landtype::min_area_units`] to 256 square extent units at extent 4096 (a 16x16-unit-/// square, ~9.5 m at z14) — a speck rather than detail, and the same floor the schema already-/// applies to the smallest z14 `landtype` kinds (`pitch`, `playground`, `platform`). Whole-number-/// because [`crate::store`] packs this field as a `u8` and refuses anything fractional rather-/// than rounding a threshold silently. Carried through the existing `min_area_px` plumbing so-/// [`crate::tiler`] needs no building branch for the drop itself.+/// `2.0`: a footprint smaller than two display pixels at z14 (Phase C floors — sub-2px+/// sheds/garages). Converted by [`super::landtype::min_area_units`] to 512 square extent units+/// at extent 4096 (a ~23x23-unit square, ~13.5 m at z14) — a speck rather than detail, and more+/// aggressive than the floor the schema applies to the smallest z14 `landtype` kinds (`pitch`,+/// `playground`, `platform`). Whole-number because [`crate::store`] packs this field as a `u8`+/// and refuses anything fractional rather than rounding a threshold silently. Carried through+/// the existing `min_area_px` plumbing so [`crate::tiler`] needs no building branch for the+/// drop itself. /// /// The prototype at `analysis/mamaps_building_savings.py` estimates dropping the smallest ~15% /// of footprints; this floor is at least that aggressive, on the same z14-only layer (9.76M /// features, ~20% of the archive).-pub const MIN_AREA_PX: f64 = 1.0;+pub const MIN_AREA_PX: f64 = 2.0;  pub fn classify(tags: &(impl TagSource + ?Sized)) -> Option<Class> {     // A part first: a way carrying both is a part of a larger footprint, and drawing it as a@@ -353,19 +354,19 @@ mod tests {         assert_eq!(class.min_zoom, 14);     } -    /// The densest z14 layer drops what no screen can show: below one display pixel a footprint-    /// is a speck, not detail. Both kinds carry it — a part is still a footprint — and it is a-    /// whole pixel because the store packs this field as a `u8` and refuses fractions rather-    /// than rounding a threshold silently.+    /// The densest z14 layer drops what no screen can show: below two display pixels a+    /// footprint is a speck (a sub-2px shed or garage), not detail. Both kinds carry it — a part+    /// is still a footprint — and it is a whole number because the store packs this field as a+    /// `u8` and refuses fractions rather than rounding a threshold silently.     #[test]-    fn buildings_carry_a_one_pixel_minimum_area() {-        assert_eq!(MIN_AREA_PX, 1.0);+    fn buildings_carry_a_two_pixel_minimum_area() {+        assert_eq!(MIN_AREA_PX, 2.0);         for tags in [vec![("building", "yes")], vec![("building:part", "yes")]] {             let class = classify_tags(&tags).expect("building");             assert_eq!(class.min_area_px, MIN_AREA_PX, "{tags:?}");         }-        // One display pixel, expressed in a 4096-unit tile: a 16x16-unit square.-        assert_eq!(crate::schema::landtype::min_area_units(MIN_AREA_PX, 4096), 256.0);+        // Two display pixels, expressed in a 4096-unit tile: a ~23x23-unit square.+        assert_eq!(crate::schema::landtype::min_area_units(MIN_AREA_PX, 4096), 512.0);     }      fn attrs_of(pairs: &[(&str, &str)]) -> BuildingAttrs {
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 12f9464f5e..d062cfbe06 100644--- a/scripts/maps/mamaps_build/src/tiler_part7.rs+++ b/scripts/maps/mamaps_build/src/tiler_part7.rs@@ -146,12 +146,12 @@ mod tests {         features     } -    /// **The sub-pixel drop.** A footprint under one display pixel at z14 is a speck, not detail:+    /// **The sub-2px drop.** A footprint under two display pixels at z14 is a speck, not detail:     /// dropped by the `min_area_px` floor, while a house-sized one on the same build survives.     #[test]     fn a_speck_sized_footprint_is_dropped_but_a_house_survives() {         // A degree at z14 is ~186k extent units at this latitude, so 0.00005 deg is ~9-        // units a side (area ~85 < the 256-unit floor) and 0.0005 deg is ~93 units a side+        // units a side (area ~85 < the 512-unit floor) and 0.0005 deg is ~93 units a side         // (area ~8700, well above it). Both sit inside one 0.022-deg tile; one build, because         // a speck alone would leave zero tiles and the writer refuses an empty archive.         let speck = shed(-120.001, 35.001, 0.00005);