Modern Apps git

← Modern-Apps.git

maps: mamaps_build --no-junction-layer (#planet5)

Commit
fecf7617449e1fb0d06844760b9ba37151dec4a0
Author
Vayun Mathur <[email protected]>
When
2026-11-14 15:17 UTC (21 days ago)
Parents
01f0b70
The junction layer (one sampled polyline per lane connector through an
intersection) is about 8% of z14 tile bytes (~1.2 GB on the planet).
The only style layer that reads it, `junction-connector`, is a
carriageway layer, and library/map drops every carriageway layer from
the release style while style::LANE_RENDERING is false; nothing else
reads it (lane guidance uses the graph). So no shipped app draws it.

- SizeOpts.no_junction / --no-junction-layer: skip
  schema::junction::stream_junctions (the graph is still awaited, as
  the later stages expect). Part of the size tag, so it moves the
  build id.
- library/map real_archive: the every-layer test accepts archives
  with or without the junction layer (planet4 has it, planet5 not).

Follow-up, when lane rendering returns: build the connectors on
device from the graph sections the archive still carries (nodes,
edges, intermediate, lanes) -- a shared junction crate out of
mamaps_build, a graph reader over the archive in library/map, a
spatial node lookup, and a local reverse-edge scan for one-way
approaches (the graph stores no incoming-edge index).

Verified: cargo build -p mamaps_build; US West build with the flag
(report).

Diff

library/map/src/main/rust/tests/real_archive.rs
diff --git a/library/map/src/main/rust/tests/real_archive.rs b/library/map/src/main/rust/tests/real_archive.rsindex b37cd6a4c2..0f872a0d4d 100644--- a/library/map/src/main/rust/tests/real_archive.rs+++ b/library/map/src/main/rust/tests/real_archive.rs@@ -236,6 +236,12 @@ fn every_layer_decodes_and_tessellates_in_four_cities() {         println!("layer {name:<10} tiles {:3} features {}", t.tiles, t.features);     }     for name in tilecodec::mamaps::dict::LAYERS {+        if *name == "junction" {+            // planet5 (~50 GB revision) builds with --no-junction-layer: lane connectors are drawn+            // only by the carriageway style layers, which style::LANE_RENDERING drops for release.+            // planet4 still carries them; either is valid.+            continue;+        }         if *name == "traffic" {             // The writer stopped emitting `traffic` features (mamaps_build extract_part3.rs:             // "dropped as of the NA diet"); the layer stays in the dictionary with zero
scripts/maps/mamaps_build/src/extract_part3.rs
diff --git a/scripts/maps/mamaps_build/src/extract_part3.rs b/scripts/maps/mamaps_build/src/extract_part3.rsindex 9e99ccfec2..50c6e01908 100644--- a/scripts/maps/mamaps_build/src/extract_part3.rs+++ b/scripts/maps/mamaps_build/src/extract_part3.rs@@ -267,9 +267,14 @@ fn append_external_and_finish(     }     graph.wait().map_err(osm_ingest::proto::Error)?;     timer.switch("junctions");-    println!("building lane connectors from the v6 routing graph for the junction layer");-    stats.junction_connectors =-        schema::junction::stream_junctions(graph.dir(), &conventions, &mut sink)?;+    if crate::tiler::size_opts().no_junction {+        println!("--no-junction-layer: no lane connectors (the release style does not draw them)");+        stats.junction_connectors = 0;+    } else {+        println!("building lane connectors from the v6 routing graph for the junction layer");+        stats.junction_connectors =+            schema::junction::stream_junctions(graph.dir(), &conventions, &mut sink)?;+    }     stats.features += stats.junction_connectors;     println!("  {} lane connector(s)", stats.junction_connectors);     // `sink.finish` itself is a flush, not a loop: every feature was serialised and its coordinates
scripts/maps/mamaps_build/src/main.rs
diff --git a/scripts/maps/mamaps_build/src/main.rs b/scripts/maps/mamaps_build/src/main.rsindex efc42ffec1..12afc62395 100644--- a/scripts/maps/mamaps_build/src/main.rs+++ b/scripts/maps/mamaps_build/src/main.rs@@ -208,6 +208,10 @@ fn main() -> ExitCode {                 size.keep_z13_wash = true;                 Ok(1)             }+            "--no-junction-layer" => {+                size.no_junction = true;+                Ok(1)+            }             "--coord-quant" => {                 size.coord_quant = true;                 Ok(1)
scripts/maps/mamaps_build/src/main_part2.rs
diff --git a/scripts/maps/mamaps_build/src/main_part2.rs b/scripts/maps/mamaps_build/src/main_part2.rsindex 507967e65f..0bc3ce29f0 100644--- a/scripts/maps/mamaps_build/src/main_part2.rs+++ b/scripts/maps/mamaps_build/src/main_part2.rs@@ -75,7 +75,7 @@ fn usage() {         \x20                   [--build-graph-to DIR] [--build-poi-to DIR]\n\         \x20                   [--graph-ready-file PATH] [--v8-bodies]\n\         \x20                   [--body-zstd LEVEL] [--dem-max-error M] [--dem-px K]\n\-        \x20                   [--simplify-scale S] [--z14-tolerance T] [--coord-quant] [--keep-z13-wash]\n\+        \x20                   [--simplify-scale S] [--z14-tolerance T] [--coord-quant] [--keep-z13-wash] [--no-junction-layer]\n\         \n\         \x20All six flags are required. Every build carries all 9 layers at\n\         \x20z0-14 as FORMAT_VERSION 8. --region filters roads/pois/buildings\n\
scripts/maps/mamaps_build/src/tiler.rs
diff --git a/scripts/maps/mamaps_build/src/tiler.rs b/scripts/maps/mamaps_build/src/tiler.rsindex 090a863453..d14250e0ca 100644--- a/scripts/maps/mamaps_build/src/tiler.rs+++ b/scripts/maps/mamaps_build/src/tiler.rs@@ -357,6 +357,11 @@ pub struct SizeOpts {     /// parent's wash under every z14 tile (z14 drops wash areas), so z13 landtype is what users     /// see at street zooms and its deviation is magnified 2^(view-13) times.     pub keep_z13_wash: bool,+    /// `--no-junction-layer`: build no lane connectors. The only style layer that reads them+    /// (`junction-connector`) is a carriageway layer, dropped from the release style while+    /// `library/map` `style::LANE_RENDERING` is off, so the layer is ~8% of z14 bytes no app+    /// draws (planet5 ~50 GB revision).+    pub no_junction: bool, }  impl SizeOpts {@@ -368,6 +373,7 @@ impl SizeOpts {         z14_tolerance: 0.0,         coord_quant: false,         keep_z13_wash: false,+        no_junction: false,     };     pub fn is_default(&self) -> bool {         *self == SizeOpts::DEFAULT@@ -375,9 +381,10 @@ impl SizeOpts {     /// Stable text for the build id (only hashed when non-default).     pub fn tag(&self) -> String {         format!(-            "size/zstd={};dem={};dempx={};simp={};z14={};q={};kw={}",+            "size/zstd={};dem={};dempx={};simp={};z14={};q={};kw={}{}",             self.zstd_level, self.dem_max_error_m, self.dem_px, self.simplify_scale, self.z14_tolerance, self.coord_quant,-            self.keep_z13_wash+            self.keep_z13_wash,+            if self.no_junction { ";nojunction" } else { "" }         )     }     /// The coordinate grid step for zoom `z` under `--coord-quant` (1 = untouched).