garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/prorail-level-crossings.md

raw


topic: prorail-level-crossings triggers: [crossings.rs, overweg, ProRail, Spoorwegen, spooras, wissel, kilometrering, "level crossing", overwegbomen, AHOB, AOB, azimut, levenscyclus_status, aantal_sporen, body_mentions_rail, WayFilter, mast_centres, CellPlaces, prop_colliders] updated: 2026-09-03

ProRail level crossings (PDOK Spoorwegen, overweg)

Every level crossing on the Dutch rail network, with the kind of installation standing on it and how many tracks the road crosses. cartopolis_geo::crossings is the pure half, systems::crossings the fetching half.

The interface, and what it costs

https://api.pdok.nl/prorail/spoorwegen/ogc/v1 — keyless OGC API Features, bbox query, GeoJSON out (storage CRS EPSG:28992, CRS84 is what comes back by default, longitude first). Access-Control-Allow-Origin: * and Cache-Control: public, max-age=3600, so the web build reaches it directly with no relay. limit is clamped at 1000 (asking for 5000 answers 200 and returns 1000), cursor-paged through a rel="next" link, and numberMatched is never returned. properties= subsetting is a 400 — the same shape systems::nav_marks found on the RWS service, so a feature arrives with all fifty of its administrative properties or not at all.

Licence: CC0 1.0, from the service's own landing page rel="license" link.

Per z14 cell, measured 2026-08-30 (overweg only):

cellfeaturesbytes
Groningen, Peizerweg 8490/532112,444
Utrecht Centraal 8424/5405813,374
Groningen Grote Markt 8490/53200871
Veluwe 8453/54000877

Nationally: 3,917 features, 4 pages. The empty answer is what the rail gate below exists to avoid paying for over the rest of the planet.

Six of the seven collections were rejected

The service publishes seven. Only overweg reaches the client. The rest were checked on 2026-08-30 and the reasons are recorded here so the check is not repeated — docs/direction.md's values in brackets:

Three things the register says that it does not mean

Each of these is invisible when it is got wrong, which is why they are here and not only in a comment.

levenscyclus_status is not a built/not-built flag. 2,612 features read Bestaand, 1,304 read Definitief ontwerp and one reads Onbekend. The Peizerweg crossing in Groningen reads Definitief ontwerp and has been standing in the street for years, as do every sampled spooras and wissel feature. Filtering on it — which is the obvious first thing to do with a field of that name — would delete a third of the register. This is the trap surveyed-street-objects.md records for the BGT's retired trees, in the opposite direction: there an obvious filter had to be added, here an obvious filter must not be. systems::crossings does not read the field at all, and the captured Peizerweg fixture is what pins it.

aantal_ahob is not a boom count. It is 100% filled and the single-track Peizerweg crossing reports 15. aantal_aob reads 0 on the sampled AOB features. These are asset tallies of some kind; how many booms an installation has comes from its form.

azimut is null on all 3,917 features, as are type_hek and aantal_andreas — so the register records neither the orientation, nor the fencing, nor the St Andrew's cross. The orientation has to be derived, which is the one genuinely new piece of logic in the layer (below).

The published extent is the projection's, not the register's

The overweg collection document's extent.spatial.bbox is -1.657292, 48.040502, 12.431727, 56.11059 — Rennes to Copenhagen, taking in Belgium, northern France, Germany and Denmark. That is the RD grid (EPSG:28992, the collection's storage CRS) reprojected to CRS84, not a statement about where ProRail has railways. Using it verbatim as the coverage gate would let every cell in five countries through.

The envelope actually used is measured over all 3,917 features: lon 3.593 … 7.350, lat 50.756 … 53.453, padded to 3.5 … 7.4 by 50.7 … 53.5. systems::aerial already records the general rule — coverage is an envelope, never a status code — and this is its sharper form: the envelope a service publishes may describe its grid rather than its data.

It is still an envelope and not a border. A rectangle drawn round the Dutch corners contains Brussels and Cologne, and each of those costs one empty request if a cell there has a railway in its tile. A gate tight enough to exclude them would clip Zeeland, which is the wrong trade in the wrong direction.

There is a further gate that is about the service rather than the cell — a 3 s bound on the request and a per-service breaker with a minute's cooldown, because this fetch sits between the cell's tile and its tessellation worker. It is shared with the navigation marks and is written down once, in optional-layers-on-the-critical-path.md.

The census, 2026-08-30

overweg_type (3,917, 100% filled):

Geen 2,035 · AHOB 1,157 · AHOB-MINI 381 · AOB 137 · ALI 63 · Onbekend 40 · AKI 24 · HALI 21 · WILO 16 · VKL 9 · HAVIO 9 · HBKI 8 · HAHOB 5 · EBO 4 · ALI-B 3 · HALI-B 3 · HAKI 1 · ADOB 1.

CROSSING_TABLE names eleven of the eighteen and draws nothing for the rest. Geen is a crossing with no installation — a farm track over a branch line with a sign and nothing else — and drawing anything there is the single biggest way this layer could lie; Onbekend is the register saying it does not know. The other five left out (WILO, VKL, HAVIO, EBO, ADOB — 39 features between them) are codes whose expansion is not established; VKL in particular looks like road traffic signals rather than a crossing installation. They are recorded here so the next reader knows they were considered rather than missed.

karakter (100% filled): Openbare overweg 2,022 · Onbekend 587 · Dienstoverpad 557 · private 263 · Niet-openbare overweg met een openbaar karakter 214 · Openbare overweg (voetpad) 158 · … Not read: the form comes from overweg_type, and the road's own width is already in the tile — which is now a statement about the code and not only about the data. See below.

aantal_sporen (100% filled): 1 → 2,091 · 2 → 1,269 · 3 → 232 · 4 → 126 · 0 → 68 · 5 → 48 · up to 14. It sets how far apart the two installations stand and nothing else. Zero is read as one — a crossing nobody counted, not a crossing over no track — and the count is clamped at 16.

vri (road signals present): Ja on 24. Not read.

Orientation and width come from the road, and the rail has to be excluded to get either

The collection's own description says it plainly: "Dit punt is dus niet het midden van een overweg maar een punt op de spoorhartlijn in de buurt van een overweg" — the point is on the rail centreline near a crossing, not the middle of one. Two things follow.

furniture::WayField answers "which way does the nearest way run" and is what turns a bench toward its path, but it indexes every street, path and railway in the tile and reads no kind at all. Asked about a crossing's own point it answers the track, every single time, and every boom would be laid along the rails it is supposed to bar — a failure that looks entirely plausible from above. So the field grew a WayFilter, and road_texture::is_rail_kind (beside road_class, so the two cannot drift) is what it excludes. The test that pins it builds a field with one east–west track and one north–south road crossing it and asserts the yaw at the rail point is the road's.

And the placement is approximate at the metre level by the register's own admission, which is why the search radius is 30 m rather than the furniture's 20. A crossing with no non-rail way in range is dropped, not drawn at a guessed angle — a real loss (a service crossing over a farm track OSM does not carry goes undrawn) and the honest one. level_crossings in --dump-state therefore counts what is on screen rather than what came back from the register.

The same lookup answers how wide that road is

CrossingKind::spec used to return a constant half-carriageway per form, and every form but the mini one used 3.5 m — a 7 m road, for every AHOB, HAHOB, AOB and lights installation in the country. The Peizerweg is OSM highway=secondary, which road_texture::road_width_m answers 11 m for, and that is the ribbon this client draws. So both masts stood about a metre and a half inside the kerb, on the asphalt, and each 4 m boom covered well under half the carriageway. It was wrong the other way for the commonest small form: AHOB-MINI (381 features) assumed 1.6 m where a cycleway is 2.2 m wide and a footway 1.8 m.

The width was already within reach of the lookup that gives the yaw, so WayField now carries a half-carriageway per segment and direction_and_width returns it beside the direction. It has to be the same segment: asking twice could pick two different roads, and a crossing sized for one and turned to another is worse than either mistake alone. The number is vector_tiles::drawn_street's own — the very function the ribbon's width comes from — so the installation and the tarmac under it cannot drift.

Two constraints shaped it. WayFilter::All still reads no tags: that is the path every streamed cell's furniture takes, and it answers no width at all, which is why the width is per-filter rather than per-field. And everything across the road is derived from that one half-width: the mast stands half + 0.5 from the centre, a half barrier's bar is half + 0.5 long, so it meets the centreline when lowered, and a full barrier's is 2 × half + 0.5, so it meets the far kerb. These are bar lengths, not places a tip lands: the booms are drawn raised (see below), so that length stands up the mast rather than out over the road.

The fallback, for a way with no kind, a kind road_class refuses, or a tunnel (drawn_street declines all three), is the form's old constant — so a tile with no usable tags draws exactly what it drew before. The one number that moved there is the full barrier's reach, 7.5 m against a tabulated 7.6: the 10 cm is the accepted cost of deriving the reach instead of writing it down.

Not done, deliberately: no plausibility clamp on the resolved width. The nearest non-rail way within 30 m might be a road running parallel to the track rather than the one crossing it — but that is already how the yaw is chosen, so the width is exactly as trustworthy as the orientation this layer already ships, and bounding one and not the other would be arbitrary. lanes stays unread too: road_width_m classifies on kind and two flags, so the Peizerweg's lanes=3 changes nothing. This makes the crossing agree with the ribbon the client draws, not with OSM's lane count.

What is not drawn, and why

The masts are solid, and the buoys are not

Until 2026-09-03 this section said crossings get no collider "exactly as the navigation marks do not". That precedent was wrong here, and the reason is in world_places::prop_radius: a moored boat gets radius 0 because it sits on water the avatar cannot walk on, so a circle there is an invisible wall in the middle of a canal, and a navigation mark is that same case. A crossing mast is 0.22 m square and 3.1 m tall and stands on a verge VERGE_M = 0.5 m outside the kerb of a street the avatar walks along — the lamp column's case, which the same table gives 0.25 m and this reason: walking through one is one of those small things that tells you the world is a drawing. So a mast gets the lamp column's radius, named as world_places::CROSSING_MAST_RADIUS beside it.

How, without making crossings furniture: a bare collider channel, CellPlaces::colliders — solid and silent circles that reach the collider index and can never become an Interactable, for the reason a lamp gets no prompt. A FurnitureKind variant would have meant a mesh recipe nothing calls (crossings have their own builder) plus three arms in world_places existing only to say "never reached". Publishing through BuildingColliders::set_feature_cell was also rejected: street_detail owns that key space on the same z14 grid, so two producers would clobber each other's cells.

crossings::mast_centres is where the positions come from, and the point of it is that there is one derivation: push_crossing places its boxes off the same Layout, through the same furniture::place_ground rotation, so the circle cannot drift off the post on the next edit to either. A geo test reads the mast centres back off the built mesh at four yaws and asserts the helper agrees — a yaw-0 check would pass with the rotation's sign flipped, which is the mistake interiors' door normals made twice.

The collider index is invisible to a capture, which is how a settled shot with level_crossings = 3 on screen photographed three installations nothing could walk into. ShotMetrics::prop_colliders counts WorldPlaces::props() so a headless run can at least assert the circles exist beside the count of what is drawn. Only a walk-up on a workstation shows that the mast actually stops the avatar.

Worst case per cell: MAX_CROSSINGS_PER_CELL is 200, so 400 circles; the densest cell the register holds is 8, i.e. 16 — negligible against the linear scan in BuildingColliders::in_prop.

Ambient traffic is unaffected. systems::traffic references neither BuildingColliders nor WorldPlaces — cars follow DriveLines and consult no collider at all — so they still drive through a crossing. That is a separate gap.

Deferred measurements

Not taken, none of them blocking: