--- topic: roads triggers: [tunnels.rs, tunnel, entrance, build_structures, unmeasured_profiles, road_levels::structures, fill_to_land, land, cutting, cut_sheet, opening_digest, clipmap hole, basemap over a tunnel, building_passage, underground, drawn_street, street_shape, TunnelRoad, TunnelStructure, Tunnels, cut_ground, opening, floor_lift, layer, "the tunnel isn't rendering", "drive through the tunnel"] updated: 2026-09-28 --- # Tunnels: what the tiles know, and everything they do not Until 2026-09-15 a tunnel was a **gap**. `vector_tiles::drawn_street` refused any way the tiles flagged, the raster painter skipped it, and `extract_street_labels` withheld its name, so the southern ring road at Groningen — `Weg der Verenigde Naties`, eight of whose segments are flagged — was simply absent between its entrances: no carriageway, no markings, no name, nothing to walk into. That refusal was right about one thing and silent about the rest. Painting a tunnel **on the ground** rules a pale band across every junction it passes under, which is a lie about what is up there. Nothing ever drew it anywhere else. ## Where a tunnel is, and how deep, is decided on the road network (2026-09-28) **Read this section first; much of what follows is the history of a planner that no longer exists.** From 2026-09-15 to 2026-09-28 `tunnels.rs` laid tunnels out from the tags alone — which ends were entrances, which surface way beyond a portal was its ramp (`find_approaches`), which untagged gap between two lids was a cutting (`bridge_short_gaps`) — at an invented depth, and then every consumer lifted the result back by whatever the survey had already dug (`lift_for`, `stand_tunnel_on`, `convention_depth`, `cover_over`, `road_under_measured`). The sections below record why each of those rules existed; the rules themselves are gone. What replaced them is the model [bridge-heights.md](bridge-heights.md) built for bridges, run the other way: - **Every street has a height solved on the network** (`road_levels::solve`). A tunnel is a ceiling on its road — the land less a level's depth — and the grade limit working from that ceiling is the ramp, exactly as it works up from a deck. - **Around a structure, every street also has the land it runs through.** Over a tunnel that is the lid, the level of the land around (`lid_level`, 80th percentile of sixteen samples at 30 and 60 m). Beside any other road it is the **bank**: on each side the first measured ground past the carriageway — skipping the hole the bare-ground survey leaves where it cut a wall out — and the highest of it over the next four metres; the higher side wins, so a dual carriageway's median does not count (atlas's `bank_level`). Close on purpose: a wall is abrupt and a slope is not. Read the ring way, 30–60 m out, a cycle path across a park falling gently towards the ring came out nearly three metres under its land and was walled for a hundred metres where the aerial photograph shows it at grade (2026-09-28). A road in a structure's trench whose own bank is another lane of it — a carriageway with a slip road between it and the wall — takes the structure's land (`in_the_same_trench`), and the land is median-smoothed along the line so one misread bank does not notch a wall. - **A structure grows out of a tunnel along the network** (`road_levels::structures`): every point below the ground, and from there every point it reaches that runs more than `SUNK_M` (1 m) under its land. So a ramp, a cutting between two lids and a ramp crossing a tile border are one thing, and a road that is merely low — at the foot of a dike, in a street between gardens — is not walled, because nothing connects it to a tunnel. - **The survey says where the walls stand, and whether there are any** (atlas's `wall_sides`, published as the `WLL1`/`WLR1` sections). A cutting's side is a wall where the ground climbs from the road's level to its land within `WALL_RISE_M` (3 m — the survey's own lattice spacing makes a vertical wall read as a rise over one sample), and a bank where it climbs more gently. The wall stands just past the last ground still at the road's level, so it is also how wide the trench is; between it and the carriageway the client lays floor, and the opening reaches out to it. A side that is a bank has no wall, is not filled back to the land, and is laid to the road like any road's verge; a point that is a bank on both sides is not a structure at all. The gallery found why: about twenty cycle underpasses had their ramps drawn as a walled slot the width of the path's line inside paving at street level, where every aerial photograph showed a ramp five or six metres wide going down between grass slopes (2026-09-28). Where a trench is wider than the bore it runs into, a wing closes the gap between the two walls. - **A trench is at least as wide as the paving it carries** (atlas's `Paving`, from the `bgt` dataset's surveyed road surfaces). The bank and the walls are read from the edge of that paving outward, not from the edge of OSM's line: the ramp into the bike park under the station square is a two-metre path in OSM, ten metres in the BGT, and a hole in AHN, and read from the line the bank landed on the ramp and it was never built (2026-09-29). With it, a side of a cross-section with no survey at all is *unknown*, not a bank, and a rise with nothing measured part way up is a wall however wide the hole it crosses. Grading needs the `bgt` cells in the published tree; without them it falls back to the line's own width. - **Every rule here is checked by `tunnels::audit`, not by eye alone.** It reads the plans the builder draws and reports three kinds of flaw — a street at grade an opening swallows (`slot-through-street`), a roof lower than a metre over its road (`ceiling-out-of-place`), an open end below the land that nothing meets (`step-into-nothing`). Atlas runs it over every graded tile, logs the count per kind with the run (`gebreken: …`) and publishes each flaw's place in `roads/mouths.json`, and `tools/structure_shots.ts` photographs every one beside its aerial photograph. **A change to these rules should leave the counts no higher**; the fixtures are held to no slots and no steps. First run over Groningen, 2026-09-29: 18 slots, 19 steps, 20 low roofs, 3 tunnels built as nothing, from 134 mouths. - **A structure only starts where a tunnel is really below the ground** (`road_levels::structures`): a tunnel's point within `SUNK_M` of its land does not seed one. On flat land those were half-metre "tunnels" whose openings cut the streets crossing them. - **A tunnel is roofed wherever a street at grade crosses over it** (`tunnels::crossed_by_streets`), even where its headroom and a full slab do not both fit under the land: there the ceiling is held `ROOF_SLAB_M` under the land and the headroom gives, down to `MIN_HEADROOM_M`. Cycle underpasses 2–3 m under the road they pass below were left open and cut a slot across the whole road (2026-09-29). A street on a bridge does not count — it spans a cutting — and a tunnel deep enough for its roof anyway is left exactly as it was, so the flag cannot move its vertices. - **The fill to the land stops at a structure's end.** It used to round off around the end, and once a sloped ramp stopped being part of the structure that raised the ground over it back to the lid 30 m out and buried the mouth. - **Under a lifted bridge deck a "tunnel" is a road under a span.** OSM tags a path beneath a bridge as a tunnel as readily as one beneath an embankment; read as a bore, the space under the ring's bridge by Kardinge was filled with ten metres of grass. Atlas measures such points like any road — survey height, bank land, survey walls — and the client never roofs a point atlas measured walls for. - **A BGT retaining wall standing proud of flat paving is usually right.** The surveyed walls layer draws the BGT's `scheiding` walls at their measured height; beside a path at grade through an embankment they hold the embankment back, and the survey (`print_terrain_along_a_line`) is how to tell that apart from a ramp the ground failed to dig (portal 06, 2026-09-28). - **Atlas decides all of it** over its solve window and publishes the land beside the road heights (`roads/14/x/y.bin`, an `LND1` section after the runs that older readers never reach). The client builds the walls, roofs and openings from those numbers (`tunnels::build_structures`) at their final heights, and nothing lifts them afterwards. - **Where atlas has not been**, the tile's own runs are solved on flat land (`tunnels::unmeasured_profiles`) — the same solve with the survey taken out — and stood on the land around each point. That cannot see past its own tile. - **The ground is one rule with three cases** (atlas's grading): at grade it is laid to the road; under a span it stays; over and beside a structure below the ground it is the land (`terrain_grade::fill_to_land`), which is also the height the walls stop at. The client applies the same fill to ground atlas did not grade. Four things the network needed that the planner had papered over: - **A road that ends on another road meets it, vertex or not** (`road_levels::TEE_M`). Shortbread generalises each feature on its own, so where a cycle path tees into a street the street usually has no vertex there, and a tunnel's line and the road out of its mouth were measured 0.8 m apart on the ring fixture. Joined only at shared points, the ramp out of a cycle underpass ended three metres down on the side of the street it runs into. - **A junction at grade holds its height against a ceiling.** With the tee joined, the ceiling of a cycle underpass whose path met a street six metres from its mouth dragged the street three metres into the ground. Junctions (three or more segments, no tunnel through them) are now floors the ceilings yield to: where the road out of a mouth meets another road before it can climb back, the ramp moves inside the tunnel and its mouth opens earlier — what the planner did for short approaches, arrived at by the solve. And a ceiling a junction lifts is lifted *before* anything is graded from it: lifting the tunnel afterwards left the roads beyond graded from where it had been, deeper than the tunnel they lead out of. - **A road near a lid is measured on the lid.** The survey still shows parts of Groningen's ring as the trench it was flown over, so a road within reach of a tunnel it does not run into is measured on the ground as atlas puts it back — the lid, blending out over the same 30 m taper — and never lowered by it. - **A short gap between two roofs is a seam in the tagging** (`MIN_OPEN_M`, 25 m), and stays roofed. - **A road that ends in nothing below its land is closed by a wall.** A tunnel into a garage the map does not draw, a stub of path: the end of the corridor showed the void past the carriageway. ## The tiles carry one bit Measured on `crates/geo/tests/fixtures/groningen_z14.mvt`, 2026-09-15, and pinned by `tunnels::tests::the_tiles_say_which_streets_are_tunnels`: - **Ten** streets in that tile are flagged `tunnel`. - The `streets` attribute set is `kind, bridge, tunnel, rail, oneway, oneway_reverse, link, surface` (plus `service`, `bicycle` on some). There is **no `layer`** on any feature in the layer. The second point has two consequences. A tunnel's depth cannot be read, so `LEVEL_DEPTH_M` (7 m) is a convention applied to every tunnel equally — the one number here a real source could replace. And `vector_tiles::layer_of` answers 0 for every street on this tileset, which makes the raster's "OSM layer first, so a flyover paints over what it crosses" sort a **no-op**. Its doc comment says Shortbread carries `layer` on `streets`; on this tileset it does not. That is a separate thing to fix and is not fixed here. ## An arcade is flagged a tunnel too OSM's `tunnel` also covers `building_passage` — a way *through* a building, at ground level, that people walk down. Over the Groningen ring box roughly a quarter of the flagged ways are those (12 of 44, Overpass, 2026-09-14). With no `layer` to separate them, sinking every flagged way seven metres puts a hole under a shopping street. The tile answers it, because a passage runs through a building and a tunnel does not: `tunnels::building_passages` tests points along each flagged way against the tile's own `buildings` polygons and calls it a passage on a majority. Those stay on the ground sheet and are drawn as ordinary road — which is *more* than they had before, since the old rule dropped them with everything else. It fails safely. A tunnel mistaken for a passage is drawn where it always was; a passage mistaken for a tunnel is the visible error, and needs the way to spend most of its length inside a building footprint to happen. ## The entrance is invented, and it has to be OSM tags the tunnel at full depth for its whole length, and the road that descends to the entrance is an ordinary surface way with nothing on it to say it is a ramp. Drawn literally that is a carriageway seven metres down meeting one at ground level with a vertical step between them — a hole in the road. [bridge-heights.md](bridge-heights.md) hits the same constraint from the other side and **accepts** the step: a deck with abrupt ends still reads as a deck. A tunnel cannot, because the step is the way in. So a ramp is built at `MAX_GRADE` (6 %), which puts a 7 m descent inside 120 m — **on the road beyond the portal**, not inside the tag (below). An end is a entrance only if the line genuinely ends there: a run the tile border cut is held at full depth (so the two halves meet flush at the border), and an end another tunnel run also ends on is a tagging split, not a opening. ### The ramp is outside the tag, because the tag is the lid **Settled 2026-09-23.** Until then the ramp was built *inside* the tagged run, which assumed OSM tags the whole descent. It tags the covered part. Groningen's ring under the Oude Winschoterdiep is the case that showed it: the tagged way runs from the last lid to about 35 m past the canal, and in the world the road climbs out on roughly 300 m of open ramp beyond that, tagged as ordinary road. With the ramp inside the tag, the carriageway under the canal was 2 m down and roofless — the phone showed the ring crossing the water at grade. So `find_approaches` looks, at each entrance, for the way that carries on from the portal (an end within `SAME_POINT_M`, leaving within `JOIN_COS` of the tunnel's heading), follows it through further ways while exactly one continues, and builds the ramp there as an open cutting keyed to that street. Four rules, each a failure it avoids: - **A ramp stops short of anything that meets it at grade** (`APPROACH_CLEAR_M` before the first crossing street, T-junction or other tunnel). A node where a third road joins ends the walk for the same reason. Otherwise the cut digs a hole under a crossroads. Bridges do not stop it — they go over. - **Whatever does not fit outside is still spent inside**, so a portal with no approach, or a short one, behaves exactly as before. The run's depth is solved with the outside share known (`depth_for_run`'s `outside`), so a short underpass whose approaches take both ramps now reaches full depth and is covered end to end instead of sagging. - **The opening merge is "beside, not beyond".** A short tunnel can now open at one end outside and the other inside; the two corridors are parallel, near, the same road and the same width, and hulling them as a dual carriageway cut the ground away over the lid between them. They must overlap along the road now. - **Traffic samples the deck every 12 m on a sunken line** (`DRIVE_DECK_STEP_M`). An approach is routinely one straight segment; sampled at its ends, a car sank from −7 m to 0 over the whole way while the drawn ramp surfaced after 117 m. `a_road_under_water_has_a_lid_over_it` pins it: no open, sunken stretch of deck may lie inside a water polygon, and the ring's must lie under one covered. What is still wrong: an approach that leaves the tile is cut at the border and gets only the ramp that fits this side of it; and a portal that sits exactly on the border, with its approach in the neighbour, has no tunnel in the neighbour's tile at all, so the neighbour draws that road at grade. ### The roof and walls face in Also 2026-09-23, from the same phone session. The tunnel material culls back faces, and the roof was wound like the deck — facing up into the earth — while both walls faced outward. From inside a lid there was no ceiling and no sides; with the ground's underside culled as well, the deck looked out on sky, the far city and the lawn's grass hanging overhead. The inner notch at a bend was also a real triangle wound backwards, not the "degenerate" one the code assumed. `every_tunnel_face_is_wound_toward_its_normal` checks every triangle against its declared normal. ## The corridor is the chain, not the tagged run **Settled 2026-09-22, and it is the fault every capture of this feature had been photographing.** Groningen's southern ring is built *dicht-open-dicht-open* — lid 174 m, open 109 m, lid 241 m, open 107 m, lid 233 m — and the tunnel flag marks only the covered parts. So the ring arrives as six lid runs with ordinary *untagged* road between them. `bridge_short_gaps` already had to find those connecting ways: it is how it knows the lids either side are not portals (a gap shorter than `2 × ramp_m` cannot reach the surface whatever the map says). Having found them it threw the geometry away. Nothing else looked at them, so `tessellate_roads` drew each one as an ordinary carriageway on the ground at `y = 0` — **between two decks seven metres below it**. Measured on `groningen_ring_z14`: 863 m of carriageway with **six vertical seven-metre steps** in it. From above, the road ran out of the city and stopped dead in a park; `dump_the_fixture_bores` printed the whole 239 m of the deepest run as `-7.00 m` from metre zero, with no ramp anywhere, because that run is a *middle* lid and both its ends are gap-joined. Each gap is now absorbed into the corridor as an **open cutting**: the same deck, walls and ground hole a tunnel already builds, and never a lid, because the one thing the tile does say about that stretch is that it is not covered. Three things follow and each was a bug before it was a rule. - **A cutting's depth is the depth of the lids at its two ends**, interpolated, not its own idea of full depth. A lid that had to settle for less (`depth_for_run` reduces the depth until `MIN_COVERED_M` fits) would otherwise step at the join — the same fault, moved along by one road. That is why `Plan` exists: every run's profile is resolved before any of it is built. - **A short gap is a seam in the tagging, not a stretch of sky** (`MIN_CUTTING_M`, 25 m). *Not tagged* is not the same as *not covered*, and on the station fixture two path tunnels end four metres apart; opening that punched a 5 × 4 m hole in the ground over what is plainly one continuous tunnel. Under the threshold the deck runs through and the lid carries on. - **The ground and the surface ribbon come away for free.** `cut_ground` already cuts every group `is_ground` admits, and that includes `Road` — so emitting the cutting's opening removes the flat ribbon that was drawn over it with no change in `tessellate_roads` at all. `the_ring_road_never_steps_between_a_lid_and_the_road_beside_it` is the guard, and it is local: at every end of every sunken carriageway either another corridor continues at the same depth, or the road has come back up, or the tile border cut it. A step is none of those, and the test names the place and the height. ### The opening merge needed tightening to take it `parallel_and_near`'s proximity half is an overlap of *bounding boxes* grown by `MEDIAN_M`, which two long diagonal corridors satisfy a long way before the corridors themselves are near. With the cuttings present, a 46 m footpath and the ring's carriageway **88 m away** passed it, were parallel to within a degree, and hulled a **130 × 102 m crater** out of the park between them. Tightening the distance does not settle it: the two rings come within 19 m at one corner, and a cutting legitimately *touches* the lid it joins. What actually distinguishes the case the merge exists for is that a dual carriageway's halves are **the same road** — same class, same width, mapped as two ways — so that is the key now, and a footpath can no longer be hulled into a trunk road however parallel it runs. ## A tunnel is covered, and it took two wrong rules to get there The roof rule went wrong twice, and both times the symptom was the same picture: a long open ditch where a tunnel should be. **First: roofing only under a building.** The tiles do not say where a lid is, and they do say where a building is, so a way under a building was treated as covered and everything else as an open cut. Groningen's ring runs under a *park*, so nothing was ever covered. The observation that pushed me there — roofing by depth "buries the whole ring, with nothing to see" — is not a bug report. It is what a tunnel looks like from above. Depth decides now; the buildings layer only tells an arcade from a real tunnel. **Second: a dual carriageway could never surface.** A road only opens where `open_ends` decides it genuinely ends, and that test asked "is there another tunnel's end within 25 m pointing the same way?" — meaning a way somebody had split in two. The two halves of a dual carriageway end *side by side* at the entrance, about eighteen metres apart, pointing the same way. Each saw the other, both were called splits, and neither got an entrance: measured over Groningen, **every 7 m road tunnel in the streamed map was sealed from edge to edge, with no entrance anywhere**. Beside is not beyond, and the test now requires the offset between the two ends to lie *along* the road. Same tile after the fix: four entrances on the deep roads, 6.0–6.7 m down, in opposite-heading pairs. ## What the ring's portals taught, 2026-09-23 Bisected on the Deck with `CARTO_DBG_HIDE` (and `!word` to look at one layer alone), which is the instrument to reach for before guessing — four guesses about one pale block in a mouth were each disproved before it existed. - **The pale block in each mouth was the portal frame**, OSM building 1157021132, a 35 × 5 m strip across both mouths, standing on the survey's trench floor. Both OSM tiers (the detail patch *and* the far tier, which also draws near the camera as the patch's fallback) and lod22 leave out a building whose outline is over a covered corridor or an opening **and** stands more than `TRENCH_DUG_M` below the land around (`tunnels::footprint_in_a_covered_trench`). They rebuild when the lids *or the terrain* under them change (`lid_key`): judged before the field landed, the frame was kept, and it came and went with streaming order. - **The survey's own tunnel walls** — the east headwall at 7.02 m, the north cutting's retaining wall at 9.11 m — are measured trench floor to top and were stood *up* from the ground as boundary boxes. `wall_of_a_sunken_road` leaves a wall to the tunnel when most of it lies along one. - **The fill's target** is the 80th percentile of sixteen samples at 30 m and 60 m (`TerrainField::lid_level`): the highest sample jumped near any ramp, the middle one sank into a construction pit wider than the ring. Over a covered corridor, and within `COVER_REACH_M` of one, it is never below the roof plus its slab (`Tunnels::cover_over`). It fills **beside** a deep cutting as well as over a lid (`fill_weight`), and wall tops rise to the ground as drawn. - Trees, grass, the basemap (by the least lift in a vertex's neighbourhood, so its coarse quads stay under the vector ground) and the half-metre shading all take the fill now; traffic on a sunken line stands on `at`, the field its deck was drawn on, not the half-metre `ground_at`. Still open at the east portal: a thin dark line along the median toward the canal in an oblique view, which the layer bisect puts at the ground meeting the tunnel rather than in the tunnel mesh, and pale bars across the canal that look like the quay walls' measured height stood up from the ground the same way. ## The ground over a lid is filled back in **Settled 2026-09-16: where the two sources disagree, the map's tag wins.** The height survey measures what it flew over, and Groningen's ring was an open trench when it was flown — it has a lid on it now. So the survey digs nine metres out of ground that is continuous, the lid stays at street level, and a covered road reads as a raised platform with a ditch either side. `Tunnel::covered_weight` answers "how much is the land here ground over a lid", and `map_geometry::stand_on_terrain` lifts the ground back to the level of the land around it by that weight. Four properties, and the test pins all of them: full over the covered stretch and its own width, **zero over the open ramp** (the fill must never close the hole you drive through), zero away from any tunnel, and a smooth fade over `TUNNEL_DATUM_M` rather than a step, because a hard edge is a crease running the length of the road. The shading is flattened with it — a surface lifted out of a trench is level, and lighting it with the trench's slope would shade a flat lid as though it still dipped. What it costs: where the survey is *right* and a road is genuinely in an open cut with a lid only over part of it, the open part keeps its measured trench and the covered part is filled — which is the correct picture, but it means the ground beside a covered stretch is no longer what AHN measured. That is the trade, taken deliberately: the tag is the newer fact. ## Superseded: the lid floated over its own ground The measured ground says that road is in a nine-metre open trench, because it was one when AHN flew it. The tag says tunnel, so it now gets a lid at street level. The ground beside it follows the measurement down and the lid does not, so the covered stretch reads as a raised platform rather than as ground you can walk over. Two ways to settle it and it is a question about sources, not a bug: - **Believe the tag** and raise the ground over the covered stretch to the surrounding level, so the lid is flush. The Ring Zuid lid is newer than the elevation survey, which argues for this. - **Believe the measurement** and only cover where the ground above is genuinely continuous. Truer to the laser, and gives back the ditch. ## Superseded: the deck stood four metres above the ground beside it Reported 2026-09-17 from a phone over the ring, as a carriageway drawn on top of raised terrain instead of under it. Two unrelated faults with the same symptom. **The deck asked the depth buffer for an enormous bias.** `geo::tunnels` filled its per-vertex rung attribute from `road_rung`, which has not been the depth ladder since `89125ef` collapsed it to two rungs on 2026-08-26 — it survives as the order the road *cut* runs in and still returns 0..399. Tunnels were written three weeks later against a doc comment that still claimed the value reaches the graphics card. With `bridge: true` that is rung 391–398, about **25,900 depth units** against a surface road's 512, and the shader spends it as a fraction of the fragment's own depth: 0.3 m nearer at 100 m, 3.1 m at a kilometre, and past about 2.3 km more than the whole `LEVEL_DEPTH_M` the tunnel is buried by. The walls and roof carried 0 throughout, which is why only the carriageway was wrong and why nothing photographed from close up ever showed it. Two tests now walk the tessellated meshes; both fail on the old value, reporting rung 391. **And the lift really did put it above ground.** `stand_on_terrain` raises a tunnel by what the survey has already dug, capped so it cannot rise past its own depth — but the cap was the deepest vertex of whichever *merged mesh* was being displaced, i.e. a whole tile's tunnels, so everything shallower rose too far. Almost all of a tunnel is shallower: `depth_at` spends about 117 m ramping at each end and the ring's runs arrive 172–242 m long. Forty metres in, where the tessellator wants 2.4 m and the survey has dug 6.4, the deck was lifted the full 7 m and drawn **four metres above the land beside it**. The cap is now the convention depth under the vertex's own plan position (`Tunnels::convention_depth`) — asked by position rather than by the vertex's own height, so a wall top is lifted with the deck under it instead of being capped at zero and left behind. The drawn mesh, the walkable floor and the nearest-tunnel metric now share one `lift_for`; they had three versions of it, and the first two disagreeing is the avatar walking through the road. ## The roof stops where it would surface, and that is the opening There is no "how long is the opening" constant. The ceiling is drawn wherever it fits under the ground (`CEILING_MAX_Y`) and is absent where the rising deck would push it through — which is exactly the open approach. The plan corridor of that roofless stretch is handed back as a *opening*, and `cut_ground` subtracts it from the cell's ground meshes on the same worker, on `road_stitch`'s integer millimetre lattice and for the same reason: a boundary produced by subtracting one shape from another is built from that shape's own vertices, so the hole's edge and the wall standing in it are one line rather than two opinions about one line. **Without the cut there is no tunnel**, only a room with a lid over its own entrance. ## You walk in because a tunnel floor is a negative storey `interiors::InteriorFloors` already answered "how high is the ground here" for a building's upper storeys, and both movement paths add the answer (`AvatarState::floor_lift`) to the terrain. A deck is that with the sign flipped, and needs no new channel — `interiors::support_level` asks the tunnels first. What keeps the two apart is the rule that was already there: a surface more than `STEP_UP_M` above you cannot pick you up. From the pavement over a tunnel the deck is unreachable, so you walk over the tunnel; from inside, the ground over your head is unreachable, so you walk along it. The only way between them is the ramp, which rises continuously out of the deck — exactly as the only way upstairs is the flight. The walls have to be real collision. Without them, walking into one leaves the carriageway, finds no deck under the next step, and the floor returns to ground level — which reads as being fired seven metres up through the road. So a tunnel is a **hollow** `collision::Footprint` while the avatar is inside it (`tunnels::inside`), and no collider at all while it is not: on the surface it must not be something to walk into, and underground it must be the only thing that is. The two collision worlds are exclusive in both movement paths. ## Verified, and not ![The southern ring in open cut beside DUO](../img/tunnel-cut.png) Captured over the Groningen ring on 2026-09-15 and again on 2026-09-16 with the basemap cut (`--shot`, lavapipe, 53.20548 6.57498 at 35 m, pitch −25): 41 tunnels standing in the streamed cells, deepest deck −7.0 m, 68 clipmap tiles carrying a hole, and the sunken dual carriageway of `Weg der Verenigde Naties` in the trench with its markings and its traffic on it, retaining edges either side, and the ground unbroken where a building covers it. **Aiming a camera at a tunnel is harder than building one**, and two days of this work went on it. A shallow look *along* a tunnel — the angle that should see furthest into an open cut — is blocked by the trees standing along the corridor: at 18° above the horizon the frame is a wall of canopy. Deriving the camera from the way's own geometry (an Overpass query, the bearing across the midpoint, the camera placed back along the view direction) fixes the *direction* and does not fix this. What works is the picture above: close, and steep enough to look over the trees into the cut. `docs/grade-shots.toml` is the list, and its tunnel entries are the ones still worth re-aiming. The floor rule is unit-tested in all four directions it can go wrong (`interiors::tests`): the pavement over a covered tunnel holds, the ground overhead cannot lift you off the deck, the opening drops you onto the ramp, and ordinary ground beside a tunnel is unchanged. **Walking through one has not been seen end to end.** Standing the harness's avatar on a deck needs it to spawn on a specific 12 m strip of carriageway, and it spawns ~40 m from the `--at` point for a reason this work did not run down — `avatar_floor_m` in `--dump-state` reads 0 in every attempt, which is the honest report of an avatar on the surface, not of a floor that failed. The instrument is there for whoever aims it: `avatar_floor_m` is the tunnel deck's level when the avatar is on one. ## The basemap needs the same hole, and every level of it Cutting the vector ground is not the whole cut. Under those surfaces lies the raster clipmap — `y = -0.03` for the finest level and 0.4 m lower per coarser one (`map_stream::level_y`) — painted with a picture of the same streets. All of it is above a seven-metre carriageway, so a cut that opens only the vector sheet opens the tunnel onto a copy of the map: the 2026-09-15 capture over the merged ring trench shows pale ground with the city's own cars drawn across the opening. So `tunnels::cut_sheet` takes the same rings out of a clipmap tile's own mesh, in `terrain::displaced_grid` — the one place a tile's triangles exist. Three things follow: - **Every level is cut, not just the finest.** The pyramid stacks its levels 0.4 m apart and sinks the unrelieved ones to just under the terrain field's lowest point, a few metres in a polder. Cut only the top one and the tunnel opens onto z10 imagery instead of z17 imagery. - **A tile that needs neither relief nor curve now needs a mesh anyway.** It used to share one quad per zoom; a hole cannot be shared, so an overlapped tile gets its own and goes back to the shared quad when the opening leaves. - **What a tile rebuilds on is a digest of the rings that reach *it*, not a global revision.** Every vector cell that lands changes the set of openings somewhere, and one counter would re-mesh every cut tile in the pyramid per cell of a fill — the coarse levels cover the whole city. `Tunnels::opening_digest` is quiet unless this tile's own hole moved. ## Photographing one is harder than building one Worth knowing before the next person spends a day on it. Across this work, **eleven cameras aimed at a tunnel missed** — by 28, 42, 56, 62, 64, 103, 111, 122, 136, 140 and 178 metres — landing on a park, a rail yard and the side of an office block, each costing minutes of software rendering to discover. Three causes, all now removed: - **Hand-converting the tessellator's tile-local metres** into a latitude and longitude. Two hand-written conversions disagreed with each other and both disagreed with the client. `Tunnels::nearest_entrance` answers instead, and `tunnel_entrance_lat`/`lng`/`heading` in `--dump-state` is the answer. - **Aiming by pitch at a shallow angle.** What lands in frame is `altitude / tan(pitch)` metres ahead, and `altitude` is above the map anchor's ground while the subject stands on the measured ground; with the terrain layer on those differ by metres, and at six degrees three metres of error moves the aim thirty. `--look-at lat,lng` computes the direction from where the camera really is (`shot_harness::aim_scripted_camera`). - **Aiming at the middle of an opening**, which is by definition the stretch that has *not* reached depth — a road at lawn level. `tunnel_ahead_m` is the check: zero means the capture is pointed at a tunnel, and anything else means the picture is of something else. And the pictures are barely evidence anyway on a software rasteriser at handset quality — the profile printed by `tunnels::tests::dump_the_fixture_bores` says more in ten lines than any of them did. ### Both halves of the aiming fix existed and neither could be reached Found 2026-09-22, and between them they are most of why this feature was verified by hand-aimed one-off captures for a month. **`docs/grade-shots.toml` had never parsed.** It sets `time`, `fog`, `clouds` and `rain` at the top — correctly, since a group is a set of views of one subject and a seven-metre trench reads only when the sun puts one wall in shadow — and those were not `Manifest` keys, so `deny_unknown_fields` refused the whole file. The only symptom was a one-line error from a command nothing in CI runs. The manifest built to check grade separation was therefore dead from the day it was written. `shot_presets::every_checked_in_manifest_loads` is the guard now. **And `--look-at` did not exist as a flag.** `ShotSpec::look_at` is threaded through `lerp`, the MCP surface and `aim_scripted_camera`, which has computed the aim from where the camera really ends up since the day tunnels landed; nothing could set it. So the three ring cameras the manifest shipped with were aimed by pitch, and run on a real GPU they report `tunnel_ahead_m` of **82.7, 116.9 and 89.6 m** — all three photograph a park, which is exactly what the section above predicts and what two sessions spent days rediscovering by eye. There is a `--look-at LAT,LNG` flag and a `look_at` preset key now, and the ring views are aimed at `--dump-state`'s own `tunnel_entrance_lat`/`lng`. ## Traffic drives the corridor, and its depth travels on the line `extract_drive_lines` went through `drawn_street`, which takes every tunnel-flagged way off the *ground sheet* because the geometry draws it somewhere else. That is the right answer for a ribbon and the wrong one for a **network**: it cut the drive graph at every portal, so a car reaching the ring ran to the end of its line and was recycled, and 863 m of carriageway under the park carried no traffic at all. And `drive_traffic` placed every car at `terrain.ground_at + ride height`, so even the untagged cuttings would have had their cars driving through the air over the trench. **The depth is on the line (`DriveLine::deck`), never sampled from the world.** An ordinary street crossing over the ring is at the same world XZ as the carriageway seven metres under it, so a depth read by position drops that street's traffic into the tunnel — which is `DeckPlates::lift_at`'s first attempt seen in a mirror ([grade-separation.md](grade-separation.md)). The only thing that knows which of two roads at one point a car is on is the feature its line came from, so `tunnels::SunkenWay` keys each corridor to its `streets` feature and `extract_drive_lines` samples only its own. It covers the cuttings as well as the lids, and it has to: a cutting is an *untagged* way this module has decided is seven metres down, so a consumer reading the tunnel flag would put its cars on the ground over an open trench. **The lift a car gets is the lift its road got**, through the same `lift_for`. Over an open cutting the survey has already dug the trench, so adding an invented seven metres to a measured nine would put the car nine metres under its own road. A bridge is the same question upside down and is answered the same way, except that a deck's height is a *measurement* arriving some frames after the cell, so it cannot be baked on the worker: the line carries `on_deck` and `DeckPlates` is consulted only for the lines that have it. ## What is not done - **Nothing collides with the roof**; a jump is a metre, so nothing reaches it. - **The routing graph is unchanged**: `RoadGraph` is built from the same `streets` features and never knew about the tunnel flag either way, so a route through one is drawn on the surface (`navigation.rs` says why a negative grade is not pushed down). Note the *ambient* traffic now does know — the two are separate networks and only one of them has been taught. - **Depth is a constant, and it need not be.** See below. - **A cell built before its neighbour's tunnel streams in keeps its trench.** The cell rebuild triggers are the terrain revision, the surveyed-data revision and the detail toggles; there is no tunnel revision, so the covered-road fill never reaches a cell that was already built. It shows as a ditch inside the 30 m taper, and it is permanent until that cell is retorn for some other reason. - **The raster basemap under a lid is not filled.** `terrain::displaced_grid` reads `floor_at` and nothing else, so over a covered stretch the vector ground rises to street level and the photograph of the map underneath stays down there. Anywhere the vector sheet is absent or cut, the ditch is still visible. ## Everything vertical here is invented, and two sources we already stream could replace it The tiles carry one bit. So the plan position of a tunnel is exact and *every* vertical fact in the picture is a convention: `LEVEL_DEPTH_M` (7 m), `MAX_GRADE` (6 %), `CLEARANCE_M`, and "roof it where a building is above". That is a plausible tunnel, not that tunnel, and it is why a capture of one is unconvincing however the camera is aimed. Both halves of the real answer were checked on 2026-09-16 and both exist: **The survey publishes the footprint.** `tunneldeel` is one of the BGT's 49 collections — the covered section as a *polygon*, with `relatieve_hoogteligging` giving the layer ordering the tiles lack. Seven live polygons over the Groningen ring box, all at level −1; one is 183 × 103 m centred on 53.20536, 6.57503, which is the DUO cut. That replaces `under_a_building` — a heuristic standing in for a surveyed fact — with the fact. `overbruggingsdeel` beside it is the same answer for [bridge-heights.md](bridge-heights.md). It needs a fetch in atlas's pipeline, i.e. another hand-synced format ([where-the-map-data-is-built.md](where-the-map-data-is-built.md)). **AHN measures the trench, at half a metre.** `dtm_05m` over that same polygon, 54,291 valid samples in a 120 m box: ``` min -3.64 median 5.39 max 11.05 (m NAP) range 14.69 m cross-section every 4 m: 5.5 -0.9 -0.4 -0.1 0.9 2.4 2.6 3.4 3.9 4.8 5.3 5.5 … ``` The ramp is *in the data*: the ground falls from +5.5 m to −0.9 m over about forty metres and bottoms at −3.6 m. About nine metres of cut, against the seven that is hard-coded. **Which suggests deleting the constant rather than tuning it.** In an open cut a tunnel road is not a special object — it is an ordinary road lying on ground that happens to be nine metres down. So the measured terrain should carry it and `depth_at` should not run there at all, leaving a convention only under the surveyed covered footprint, where the laser sees the roof and no instrument can see the floor. That also disposes of the double-counting this bullet used to warn about: today the terrain would dig the cut *and* the deck would be sunk into it. Two things are missing for it: the `tunneldeel` fetch above, and the fine half-metre AHN tier feeding **geometry** rather than only the shading normal it feeds today (`systems::ground_detail`).