How deep is the Barcelona metro
Barcelona on rails, the rail network in Chronotopia, draws every railway of the metropolitan area from 1848 to around 2040, and it draws the underground in real 3D: each tunnel at its depth, each platform at its level. You can open it at chronotopia.vedratic.com/en/barcelona-rails/. The track geometry comes from OpenStreetMap, which knows where a tunnel runs but not how far down.
That second number is rarely published. There are no public longitudinal profiles for the metro, FGC or Rodalies, and the figures that exist are scattered across press notes, project summaries and enthusiasts’ pages. This article is about scripts/rails-depth.py, which turns those few figures and a set of rules into a profile for every tunnel, and about how much of the result is sourced: 4.0% of the profile points. The years each tunnel exists come from a separate step, described in dating a rail network from 1848 to 2040.
Almost nothing is published
The research file data/station-depths.json has 190 rows, one per line at each station, for 160 stations. Each has a confidence: H for a project drawing or an official figure, M for a figure in metres from a secondary source, L for an estimate by rule. There are 11 H, 30 M and 149 L.
Three of the H rows are at Espanya. The Generalitat’s construction project TM-11016, for the evacuation and accessibility works there, gives platform heights above sea level against a street at 26.80 m: FGC at 15.17 m, the L1 at 14.83 m and the L3 at 6.94 m. That puts the platforms 11.6, 12.0 and 19.9 m below the street. The other eight H rows have one source each: Generalitat notes for Roquetes (56 m) and Trinitat Nova (30 m) on the L3, an Infraestructures.cat note for the three stations of the L8 extension (45 to 50 m), and, marked H in the file although they are secondary sources, Trenscat pages for Plaça de Sants (12.5 m) and Can Zam (18 m) and Catalan Wikipedia for Ferran (4.83 m). No other old interchange has a primary document for its order.
Most M rows are on the newer, deeper lines. El Coll | La Teixonera on the L5 is 74 m down, the deepest station in service according to a Generalitat note of 2010. For the older metro lines under the streets, and for every Rodalies and FGC station except Espanya, there is no figure at all. Those rows are estimated from the construction method: 9 to 14 m for a metro platform in a cut-and-cover box, 12 to 16 m for FGC.
A method for every tunnel
The method decides the depth, the minimum cover and the shape of a tunnel, so the script first gives one to each tunnel stretch (the depth summary of network.json counts 432), from the 33 rows of data/methods.json:
- Cut-and-cover, a box dug from the street and roofed over: most of the older metro, FGC under Balmes and the Rodalies tunnels.
- Mined, a vault dug from below, where the ground climbs: the L3 north of Fontana, the L4 north of Maragall, the L5 to Vall d’Hebron, the L11 and the Collserola tunnel.
tbm-stackedfor the L9 and L10: one tube from a tunnel boring machine, with one track above the other.tbm-singlefor the L9 to the airport (9.4 m), the high-speed tunnel from Sants to La Sagrera (11.4 m), the L8 extension to Gràcia (10.23 m) and the L2’s single-track tubes between Sagrada Família and Paral·lel (5.3 m inside, 6.0 m outside).
A tunnel the research doesn’t mention is mined if the ground rises 25 m or more above its lower portal, cut-and-cover if not. Another rule follows from the cover. A bore needs at least 1.5 diameters of soil above it, so in the 11.96 m tube of the L9 the upper rail is at least 22.9 m down. An L9 or L10 stretch next to a platform shallower than 21.8 m becomes cut-and-cover, which is what TYPSA and Ingemey describe at the ends of the line.
The result is in data/depth-methods.json, which lists 424 stretches: 32 have an H method (the L9 bores, from the Generalitat’s 2008 project summary, and seven L9/L10 stretches in the open or between diaphragm walls, from Ingemey and TYPSA), 180 M and 212 L. For 118 metro stretches the M means “cut-and-cover under the road”, which methods.json calls general knowledge without a specific source.
From two platforms to a profile
The profile is the height of the rail along the tunnel, and it starts at the stations: the ground from a 20 m terrain raster, minus the platform depth, minus 1.1 m from the platform to the rail. A published row is a hard point measured from the ground right there. An estimated row is soft, and its ground is averaged over ±100 m, or the bumps of the raster would make a line zig-zag.
Between stations the script first solves each chain of tunnel stretches as one line on its own, in three steps:
- A target: straight between platforms, level for 40 m either side of each one.
- An envelope: the highest profile allowed by the minimum cover of the method and the maximum gradient, which is 4% for the metro, 4.5% for FGC, 2% for Rodalies and 3% for high speed.
- The profile: the lower of the two at every point.
The gradient limit is a function that sweeps the line both ways and never lets a point sit higher than its neighbour plus the allowed climb:
def lipschitz_min(U, slope, step):
"""Highest profile under U whose gradient does not pass `slope` (array per sample) in any direction."""
z = U.copy()
for i in range(1, len(z)):
z[i] = min(z[i], z[i - 1] + slope[i] * step)
for i in range(len(z) - 2, -1, -1):
z[i] = min(z[i], z[i + 1] + slope[i] * step)
return z
So the gradient only changes where a platform, a portal or the cover forces it to. Each vertex gets a point, marked approx unless it sits on a published platform or at a portal. network.json records 9,797 profile points, 389 of them sourced: the 4.0%.
That is the profile of a chain on its own. What the chains share is then solved together, as one linear programme over every sample of every chain (scripts/rails_depth_lp.py). It keeps each tunnel as close as it can to its own profile, lets the platform with less information move before the one with more, keeps a platform with a published depth within 2 m of it, and puts the upper track of every crossing at least the separation above the lower. What the limits make impossible is not forced: it goes to unresolved in data/depth-checks.json, 60 places in the current run (49 platforms and 11 crossings).
The run checks itself in the same file: no tunnel above the ground outside its portals, no station above the street, no gradient over its limit, and no stretch under its minimum cover except 20.9 km near published platforms and portals. There remain 217 places where the gradient zig-zags by more than 1% in steps of 50 m, 68 of them with no platform, crossing, portal or junction nearby to explain it.
Who is on top
Where two lines cross, a 3D model has to say which passes over the other. The inventory in data/crossings.json lists 83 crossings, each with an expected order and a justification: a source for 27, an indirect proof such as a level plan for 22, and for 34 a rule. The rules are the ones of data/crossing-rules.json: a viaduct or a surface track goes over a tunnel, the L9/L10 goes under everything, high speed goes under the metro, FGC, Rodalies and the tram, and the newer tunnel goes under the older one. The script also looks for every other place where two tracks of different structures cross in plan, 556 in the current run, and orders them by the same rules (292 of them by construction alone).
The script then measures each crossing. Two boxes need 7.5 m between their rails: 1.5 m of floor under the upper one, 1 m of soil and 5 m from the lower rail to its roof. When an order or a gap is wrong, the coupled solve moves the line with less information, and a platform with a published depth stays within 2 m of it. Of the 83 inventory rows, 61 come out in order, 8 are on one level (Espanya’s L1 and FGC, as the project says, among them), 12 can’t be evaluated because a track doesn’t reach the crossing in the graph, and 2 are conflicts.
A few of the old interchanges show how thin the evidence is:
- Catalunya. The rule “newer goes under” put the L1 under the older L3, and it was wrong. Trenscat says the Rodalies tunnel crosses over the L3 on a bridge, and the level plan on Wikipedia puts the L3 one level below the L1 and Rodalies, and FGC lowest of all. The L1 and the Rodalies tracks share one level, side by side, in a four-track bundle with the L1 on the outer tracks; the inventory cites Trenscat, English Wikipedia and a sketch of the square that we drew on 25 October. The L3 platform is now 7 m down, from Trenscat and granmetro.es, against 9 m estimated for the L1. The order against FGC rests only on the level plan, which gives no metres.
- Gorg. The L10 was built between diaphragm walls close to the surface, and the L2 passes under it at right angles (Trenscat); OpenStreetMap tags the L10 at level −1. It is the one place where the L9/L10 isn’t lowest, and its row went from an estimated 40 m to 10 m.
- La Sagrera. Three depths circulate for the L9/L10 station: 30, 37 and 60 m. The 30 m belongs to the open macro-shaft of 100 × 50 m, the 37 m to the station’s own shaft of 38 × 19 m (Trenscat), and the 60 m couldn’t be tied to anything. At five L9 stations with both figures published, the platform is 4.5 to 12.4 m above the bottom of the shaft, 9 m at the median, so the model puts it at 28 m, approximate, in a range of 28 to 37 m.
- Passeig de Gràcia. The L3 is about 12.5 m down, according to Trenscat, which also gives the order: Rodalies over the L3, the L3 over the L2 and the L2 over the L4. The model follows it. The inventory rows cite Trenscat’s pages for the station and nothing else.
These heights then become the platform levels of each underground station in stations.json: 160 stations take them from rows of the research file, and 54 more, on tunnels without a row, from the solved profile.
How big a tunnel is
The shape of each tunnel comes from src/modules/railSections.ts. The bored tunnels have published sizes, and the code carries the source with them:
| Tunnel | Diameter | Confidence |
|---|---|---|
| L9/L10, one tube, stacked tracks | 11.96 m | H, Generalitat TM-00509 (2008) |
| L9 to the airport, tracks side by side | 9.40 m | H, same document |
| High speed, Sants–La Sagrera | 11.4 m outside | M, Ineco and Wikipedia |
| L8, Espanya–Gràcia | 10.23 m | M, Trenscat; the city council gives 10.6 m |
The 5.3 m between the two tracks of the L9 bore is a rule, from Trenscat’s description of the levels at Europa | Fira. Almost no box or vault has a published section. data/sections.json gives a source for the width of 10 stretches, copied to sectionSrc in network.json: the Gran Metro’s «Tipo TN» and «Tipo ZH» sections, 7.00 m of clear span for two tracks, the two Via Laietana tunnels of the L4, 4.80 m each, and the cover of the Aragó trench, 14.50 m of clear span. The last two give a width and no height. For the rest the sizes are defaults marked approx: a metro box is 5.0 × 5.2 m per track, and two tracks overlap into one box of about 9 × 5 m. Checked against the tallest vehicle of each system, the metro box had 0.40 m of headroom, and one line didn’t fit. The L1’s series 100 cars are 3.2 m wide and 4.31 m high, so its box was widened to 5.5 × 5.6 m.
Drawing depth so it reads
src/modules/networkSubsoil.ts sweeps each section along its profile into one mesh. A proof of concept had shown that from a kilometre away, 30 m of depth doesn’t register. So each tunnel gets a translucent curtain from its roof up to the ground, and depth can be scaled up to three times, measured from the fine terrain. From chunkOf():
const d = Math.max(0, g[k] - y[k]);
// Depth measured from the fine ground; the vertical scale deepens it. Above the ground (a portal's ramp) the rail stays.
railK[k] = y[k] <= g[k] ? g[k] - d * state.k : y[k];
The scale stretches the distance to the street, not the tunnels: a tube stays 11.96 m across, so crossings open up without the structures growing. When finer terrain tiles load, the stretches whose ground moved are measured again, as at the airports in laying an airport on real ground. The two Rodalies tunnels drawn this way are the ones behind why Rodalies can’t run more trains.
What the depths can’t tell you
- No official profile. Not one tunnel has a published longitudinal profile. The profiles of the L8, the central L9, the L4 from La Pau to La Sagrera and the high-speed station at La Sagrera could be requested from Infraestructures.cat and Adif; until then, 96% of the profile points are estimates.
- Old interchanges rest on enthusiasts. Apart from Espanya, their order comes from Trenscat, Wikipedia level plans and OpenStreetMap tags. Passeig de Gràcia’s whole order rests on Trenscat’s pages.
- The Rodalies gradient is not verified. The 2% limit is general knowledge, not a figure from Adif. The 3% for high speed comes from the gradient at both ends of the Sants–La Sagrera tunnel, 30 per mil in Ledesma and Alonso’s 2017 paper in Géotechnique and in the BOE (BOE-A-2007-12109), and the script applies it to every high-speed tunnel.
- Two crossings sit under the physical minimum. Pelai and Universitat has 3.5 m between rails, where the second track of the L1 passes over Adif’s tunnels, and Marina and Glòries 7.3 m, against 7.5 m. The check marks both as conflicts.
- One method per stretch. The high-speed tunnel’s end boxes, 365 m at Sants and 321 m at La Sagrera, sit inside longer OpenStreetMap stretches. The profile accounts for them; the method field can’t.
- Most box and vault sizes are defaults. Only ten stretches have a published width, and most of their heights are rules; a section from a construction project would replace the defaults.