Height data and terrain
Height data (DGM)
Section titled “Height data (DGM)”A module can carry its own ground, so it runs without --dgm on the command line:
heights: [(path: "example:heights/musterbahn", zone: 32)],Behind that path lies one ESRI ASCII grid per terrain tile
(<mod>/heights/<line>/x<kx>_y<ky>.asc), cut out of the state survey office’s delivery
by the route editor. A federal state’s DGM1 is hundreds of gigabytes; the corridor of a
20 km module at 10 m spacing is a few megabytes, at 1 m a few hundred.
The tiles are written at the module’s terrain detail by default — terrain_step:,
the finest grid spacing the terrain mesh is built at in the track corridor, 4 m unless
the line says otherwise:
terrain_step: Some(1.0), // metres; 1 shows a DGM1 as delivered, at 16× the vertices of 4A tile written coarser than the mesh that reads it throws detail away that the mesh could show; a module whose detail is raised after the import has to import its heights again.
The delivery can be XYZ, ESRI ASCII Grid or GeoTIFF — what NRW has delivered since it
retired its XYZ service: one single-band float tile per square kilometre, placed by the
ModelPixelScale/ModelTiepoint tags, NODATA from GDAL_NODATA, named after its
south-west corner like every state’s sheets.
Fetching the delivery is the panel’s Download… button (content::import::fetch;
headless import-module --fetch-dgm auto, or --fetch-dgm by to name a state). The
module’s anchor says which state it lies in, its terrain tiles say which sheets of that
state’s DGM1 it needs, and the dialog fetches exactly those into cache/dgm/<state>,
points the panel at that folder and — unless the box is unticked — runs the import. A
sheet that is there already is not fetched again; a stopped download keeps what it got.
Every fetched sheet is written under one name, dgm1_<zone>_<east>_<north>_<km>_<state> [_<year>].<ext>, so the folder indexes itself off the names whatever the state called the
file. Eight states hand sheets out by URL (read off their own indexes on 2026-09-06):
| State | Zone | Sheet | How | Licence |
|---|---|---|---|---|
| Nordrhein-Westfalen | 32 | 1 km GeoTIFF | index page, the survey year in the name | dl-de/zero-2-0 |
| Bayern | 32 | 1 km GeoTIFF | by corner | CC BY 4.0 |
| Niedersachsen | 32 | 1 km COG | STAC search by bounding box | CC BY 4.0 |
| Rheinland-Pfalz | 32 | 1 km GeoTIFF | index page, the survey year in the name | dl-de/by-2-0 |
| Thüringen | 32 | 1 km XYZ in a zip | ATOM feed, the survey period in the name | dl-de/by-2-0 |
| Schleswig-Holstein | 32 | 1 km XYZ | GeoJSON index of links | CC BY 4.0 |
| Brandenburg | 33 | 1 km GeoTIFF in a zip | by corner | dl-de/by-2-0 |
| Mecklenburg-Vorpommern | 33 | 2 km GeoTIFF | by corner | dl-de/by-2-0 |
The other eight — Hessen (dl-de/zero), Sachsen, Sachsen-Anhalt, Baden-Württemberg,
Hamburg, Berlin, Bremen and Saarland — want a click in their portal (a JavaScript
downloader, a generated ATOM feed, a zip of the whole state); the dialog names the licence,
links the portal and leaves the folder to Choose delivery…. A module on a state border
is told which other offices its tiles reach into: the far side’s sheets are a second
download with that state chosen. --list-dgm-tiles prints the sheet names a module needs.
All but NRW and Hessen ask for a source note (dl-de/by-2-0, CC BY) — the
attribution the dialog shows is what a module built on the data carries.
Which tiles a module carries ground on is line data:
tiles: [(x: 1189, y: 11336), (x: 1190, y: 11336), (x: 1190, y: 11337)],Every tile within reach of the track — the corridor, 1.2 km to each side — is
ground whatever this list says; tiles: holds what is attached to it. A new module
starts with the tiles under its envelope (nearest the anchor first, at most 256), so it
has ground before it has track; the Terrain tiles tool attaches more, one click each
(a click on an attached tile lets it go again; the corridor cannot be let go of, and a
tile whose centre lies outside the envelope belongs to the neighbour). An attached tile
is flat at the fallback height until the DGM import fills it. Empty means the corridor
alone — every line written before the list existed reads that way and keeps working.
A composition takes the union of its modules’ tiles.
In the editor’s Height data (DGM) panel: choose the delivery directory, the UTM zone (32 west, 33 east of 12° E) and the grid spacing, then
- Import whole module — every tile the module carries, corridor and attached, or
- Import picked tiles — only what the DGM tiles tool has picked. That tool draws the tile grid on the map: green already has heights, blue is picked, grey is ground without heights. Tile by tile is how a long line gets its ground without re-cutting what is already there, and how a tile attached later gets its heights.
Tiles the delivery holds no data for are skipped, so a module at the edge of a state’s
data does not ship plates of zeros. The panel shows the tile count (n terrain tiles — k along the track, a attached) and the coverage (n of m module tiles). Drop
reference removes the entry from the line but leaves the files. An import shows in the
editor’s terrain at once; the tiles are read anew from disk.
At runtime the module’s heights come after any --dgm given on the command line:
whoever has the original delivery keeps its finer grid, everyone else gets the module’s
cut-out.
How the ground is drawn is the terrain quadtree (content::terrain::select_nodes):
the tiles themselves — with their trees, objects, fields and roads — stand within the
load radius around camera and trains, as before; above them, nodes of 2, 4, 8 … tiles a
side draw the same ground coarser, each one 64 cells a side whatever its size, out to
four times the view distance and the camera’s far plane. Every frame the eye picks the
set that covers the module’s ground exactly once — a node stands whole beyond one and a
half times its own edge length and splits into its four children nearer — and a tile’s
ground mesh is hidden while a coarser node stands in for it. The nodes read a coarse
overview of the elevation data (32 cells per tile, sampled once and kept), so a module
that carries its ground out to the horizon costs a few hundred thousand triangles for
the whole view, and a tile attached 15 km from the track is drawn as one cell of a node.
Terrain brush
Section titled “Terrain brush”The ground comes from the DGM, and a line reshapes it with brush strokes — round stamps that are stored as data, not baked into a heightfield:
terrain: [ // Raise the ground by 6 m over a 120 m radius, fading to nothing at the edge. (lat: 52.0012, lon: 10.0031, radius: 120.0, edit: Raise(6.0)), // Pull it to an absolute height instead — a level forecourt. (lat: 52.0020, lon: 10.0044, radius: 80.0, edit: Level(143.5)),],Strokes apply in file order, so a later one paints over an earlier one exactly as it was drawn, and each one stays pickable, re-dialled or deleted afterwards. The DGM is never modified: re-importing better elevation data keeps the shaping. The track is never moved — strokes work the ground before the cutting/embankment blend, so the strip along the rails keeps rail height whatever is stamped across it.
In the route editor the terrain brush (key 0) stamps one stroke per click, with radius and height change in the tool options. Level to rail takes its target height from the nearest track — that is what levelling a station forecourt or a depot means, and it needs no elevation data in the editor. On the map every stroke draws its true footprint (warm = raising, cold = lowering, grey = levelling), so overlaps are visible; the selection panel re-dials radius and amount, Delete removes a stroke.
T shows the world itself (View ▸ Show terrain): the editor draws with the same code
the run does — the DGM, the strokes, the cutting/embankment at the track, the ground
textures, the ballast bed, sleepers and rails of every track type, the line’s trees and scenery
objects, and the signal assemblies on their mount points. A wood, a lineside hut or
a signal mast is judged where it is set instead of only in the run. Terrain and aerial
imagery lie in the same place, so only one of them is drawn at a time; a module that
brings height data starts on its world view, one without stays on the imagery. Whichever
is shown, the status bar reads out the ground height under the cursor.
Signals stand at stop there: the editor runs no interlocking, so a signal shows the lamp image its type’s first matching rule gives for an untouched situation — the picture a line shows before the first route is set. A signal without a type stays dark, and one without a model gets the run’s placeholder mast.
A stroke smaller than the terrain grid spacing (4 m at the track, up to 32 m at the edge
of the corridor) barely shows — the grid cannot resolve it. There is no smoothing brush:
smoothing needs the neighbourhood, which a stamp does not have; a large, gentle Level
is the same thing by hand.
Reference markers
Section titled “Reference markers”Markers are the editor’s drawing aids: a labelled point that says where something belongs while the track is drawn by hand. Nothing in the simulation reads them, and nothing is wired up — a marker on a level crossing is a note, not a level crossing.
markers: [ (layer: "level-crossing", label: "Dorfstraße", lat: 52.0006, lon: 10.004), (layer: "kilometre-mark", label: "108.2", lat: 52.0021, lon: 10.007),],The layer is a free name, and everything sharing it is one layer. In the route
editor’s Reference markers panel each layer has a checkbox (hide it on the map — it
is then unpickable too), its marker count, a button that jumps to it, and one that
deletes the whole layer. Retyping the layer in the selection panel moves a single marker
into another one. Hiding is session state; the markers themselves travel with the line,
so the next session still has them.
The marker tool (key 5 in the equipment box) sets one per click into the layer named in the tool options.
File ▸ Import reference markers… reads an Overpass JSON extract and turns the tags it
knows into markers, each in the layer of its tag: level-crossing, platform,
station, signal, switch, buffer-stop, kilometre-mark, bridge, tunnel,
power-tower, tower. Ways become their midpoint; the label comes from name, ref or
railway:position. Everything else in the extract is ignored, and a layer that turns out
to be noise is deleted in one click.