garage44.eu/jeroen/cartopolis

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

.. /docs/notes/surveyed-street-objects.md

raw


topic: map triggers: [surveyed.rs, paving_edges.rs, kerb, kerbs, bgt_extract.rs, "download API", scatter.rs, furniture.rs, BGT, trees, lampposts, street lighting, PDOK, plus_type, niet-bgt, scheiding_vlak, systems::surveyed, pipeline/bgt.rs, formats/bgt.rs, paving.rs, cartopolis_geo::paving, world_places.rs, road_texture.rs, vector_tiles/roads.rs, SurveyedCover] updated: 2026-10-17

Streets that were actually surveyed

The boundary half of this note has moved on. scheiding_lijn's bank protections were excluded here because a fixed 2 m form would stand masonry along every canal, and scheiding_vlak was described as a client half waiting for an extractor. Both were resolved on 2026-09-16 by giving a wall the height somebody measured — see walls-have-a-measured-height.md.

Two of this client's layers have always said, in their own module notes, that they are inventing something. scatter.rs: Shortbread's land layer carries canopy areas, "so the trees here are scattered, not surveyed". furniture.rs reads the pois layer, which has no street lighting in it at all — so until now the map had no lampposts anywhere.

The BGT — the Netherlands' large-scale topography, ~20 cm — registers both, object by object. Atlas's pipeline/bgt.rs reads it and systems::surveyed streams it.

The API behaves nothing like the BAG WFS next door

Same organisation, same portal, opposite design, and the differences are not cosmetic:

The extractor no longer pages this API — it takes one extract (2026-09-24)

Paging the API above was ~13 minutes of a ~15-minute Groningen import: one request at a time, 1–5 s a page, ~12 MB per wegdeel page. Four parallel requests measured only 1.5× faster. PDOK's download API does the same job in one request: POST https://api.pdok.nl/lv/bgt/download/v1_0/full/custom with the object types, "format": "gmllight" and an RD polygon, then poll the status and download a zip. For Groningen (9 × 9 km, seven types) PDOK built it in 12–16 s and the 64 MB download took ~5 s. The whole bgt step is now 98 s, and most of that is the wall heights from the 3D basisvoorziening, not the BGT itself (pipeline/bgt_extract.rs).

The output was compared against the files the old code served for Groningen. Every count is the same: 2,283 trees, 1,735 street objects, 14,285 walls, fences and hedges, 42,667 surfaces, 823 bridge parts and 2,810 measured walls, with the same vertex counts. Positions differ by at most 9 cm for surfaces; 4 of 14,285 walls moved more than 25 cm, the largest by 35 cm. Four things about the extract had to be handled to get there, and none is in its API description:

Coordinates did not move: the API's WGS84 and atlas's own RD → WGS84 conversion (rd.rs) agree to the 7th decimal.

Added to the generated layers, never replacing them

This was the design decision worth getting right, and the second reason is the one that settles it.

The scatter plants inside park, wood and garden polygons; a surveyed street tree stands on the pavement, which is none of those. So the two barely overlap by construction, and adding them does not double-plant.

More importantly, the BGT's tree points are optional content ("IMGeo plus") and coverage varies by municipality — including within one city. Groningen's own centre has none: all 86 tree records in the middle of town were retired in 2023, while the wider municipality has 2,340 live ones. A design that replaced the scatter where surveyed data existed would delete a park's canopy in exchange for a handful of limes, and would do it in exactly the cells where the city is densest.

So: 2,340 surveyed trees and 1,781 lampposts over Groningen, laid beside the generated layers. Where the register is silent the map looks exactly as it did.

What it plugs into, and what had to be added

Both TreeInstance and FurnitureInstance are plain position-and-size structs in the Bevy-free crate, so surveyed objects go through the same builders, per-cell merging, upload caps, distance LOD, colliders and interaction as the generated ones. Two small additions were all it took:

FurnitureKind::Lamp is new — a 4 m column with the head on a short bracket, so it reads as a street light rather than as a post from any distance.

The boundaries — fences, walls and hedges — needed a builder of their own, because they are lines and everything else here is a point. build_line_meshes stands one box per surveyed segment, at that segment's own length. Walking each line in fixed steps was the obvious alternative and is both dearer and worse: dearer because the survey's segments average 6.4 m over Groningen, so a 2 m step would triple the box count for the same fence; worse because a fixed step cannot land on a corner, so every bend gains a gap on the outside and an overlap on the inside.

Hedges are surveyed as areas, and the extractor reduces each to the line down its middle — the polygon's principal axis through its centroid, cut at its extremes. Laying boxes round a hedge's outline would draw every hedge as a hollow rectangle of hedge. Tone::Foliage is new for them, and it is palette::CANOPY so a clipped hedge is recognisably the same substance as the tree crowns above it.

None of the boundaries are solid. A cell holds ~18 km of them at the worst, which is thousands of collider polygons where the existing index takes circles for props and footprints for buildings — the same call moorings makes about boats, for the same reason, and the same one to revisit if walking through a garden wall starts to matter more than the cost.

Solid and interactable stopped being the same list. Every furniture instance used to become both a collider and a prompt, which was fine while the only source was pois — a layer of things people visit. A city's worth of lampposts breaks that: a column is firmly in the way and there is nothing whatever to do with one. world_places::prop_interactable is the split.

The paving, and why it does not draw the road

wegdeel and ondersteunendwegdeel are the road surfaces, and the obvious way to use them replaces tessellate_roads with the survey's own polygons. That was rejected, and not on effort.

What the OSM path draws is not just a shape. Each ribbon carries a road texture — lane dashes, edge lines, wheel tracks, ballast and sleepers — a kerb casing, and a rung on the per-vertex depth ladder that keeps a slip road under its motorway and a level crossing under its rails. The BGT cannot supply any of it: its own road-furniture collections (weginrichtingselement_lijn / _vlak) come back niet-bgt on every feature over Groningen, so there are no markings in there to draw. Swapping ribbons for polygons trades a marked, ordered network for an unmarked flat one and calls it an upgrade because the outline is more accurate.

So the sources are split by what each is good at, and the split is clean because they then describe different ground:

The one overlap is the footway and cycle network, which OSM does draw as RoadClass::Path. Over a covered cell those ribbons are suppressed (tessellate_roads_surveyed's SurveyedCover::Paths, deciding by road_texture::surveyed_paving_supersedes) and the polygons stand in their place, so no ground is drawn twice. The rule names the kinds rather than the class, because pedestrian maps to RoadClass::Minor and a class test left every pedestrian street drawing a 5 m tarmac ribbon over the paving the survey had already laid — the Grote Markt is fourteen pedestrian ways, and came out as a scatter of tarmac stubs across the square (2026-09-11). surveyed_paving_drops_the_path_ribbons_and_no_whole_class_else and surveyed_paving_also_drops_the_pedestrian_ribbons pin the two halves.

The local streets moved to the survey on 2026-10-01, so the first bullet above now holds only for marked roads. Atlas also extracts rijbaan lokale weg and woonerf (PavingKind::Street / LivingStreet); over a cell whose paving file carries either, map_geometry asks for SurveyedCover::Streets and the residential, living_street, service, unclassified and pedestrian ribbons go too (surveyed_streets_supersede). The argument for OSM above survives for tertiary and up — those carry the lane markings — while a Dutch residential street carries none and is as often brick as tarmac. A cell surveyed before atlas took the carriageways has no Street surface and keeps its ribbons, which is why the cover is decided per cell from the file rather than by coverage. PavingKind::Road (a regional road or motorway carriageway) is extracted too, but only as the strip either side of the OSM ribbon, cut out from under it.

Paving takes its own depth rung, above the ground fills and below the road band. A surveyed pavement and a nominal-width OSM carriageway do not agree to the centimetre about where the kerb is, so they lap over each other here and there — and with the road on the rung above, the overlap reads as tarmac meeting the kerb rather than as a z-fight down every street.

The rung was what held that apart, and it stopped being enough on measured ground. It is 1.0 mm of height, and once the Height layer bends each sheet onto the survey against its own triangles the two disagree about where the ground is by decimetres — so on 2026-09-17 the pavement was photographed standing through the middle of the carriageway on Weg der Verenigde Naties. Since 2026-09-18 the carriageways are cut out of the paving (paving::cut_paving_under_roads), which removes the overlap instead of ordering it, and the rung is the backstop it is everywhere else in the-ground-stack.md. Every road wins, because the ribbon is the piece carrying the lane markings, the kerb casing and the depth rung and a hole cut in it has nowhere to get those back from.

Simplification is not optional. The BGT is a 20 cm survey and its rings are correspondingly dense: one page of ondersteunendwegdeel over Groningen is 77,202 vertices, of which 4,792 survive a 10 cm Douglas-Peucker — 94% of the data is collinear filler along straight kerbs. Ten centimetres is far below anything visible at any distance this layer is drawn at, and without it a city's paving is hundreds of megabytes. With it, Groningen is 95,967 surfaces in 44 MB, and the densest cell is 3.8 MB — about what a LoD2.2 building cell costs, which makes this the second-heaviest thing the client streams.

Surfaces at a relatieve_hoogteligging other than zero are dropped: that is paving on a bridge or in a tunnel, and this layer lies flat on the ground, so drawing a viaduct's footway at street level would run a pavement through whatever is underneath it.

What the paving is made of is a second axis, and it was already being fetched

Added 2026-08-29. PavingKind answers what the ground is for — pavement, parking bay, verge — and the survey answers what it is made of in a different field, which this extractor had been reading past. Colour is a property of the substance rather than of the purpose: a brick pavement and a brick parking bay are the same colour, so where the register names a material it decides the tone and the form's own tone stands down.

Two fields carry it and only one of them is usable as a substance:

What that square kilometre turned out to be, by surface count: 885 concrete pavers, 699 fired brick, 558 tiles, 248 asphalt, 200 decorative stone, 128 concrete, 55 grass, 34 gravel, 580 with nothing said. So the pavements alone split three ways — brick, concrete block, slab — where the map had one grey.

The remaining sixth still arrives with no material, and that has to cost nothing: None reproduces the form's tone exactly, which is what keeps the layer safe outside the country that publishes the register. It is the same contract building_facts built on its alpha channel, and there is a test on it.

The material is a trailing wire element rather than a field ([kind, rings, material?]), so the two-element form still reads — which matters because a paving cell cached before this existed would otherwise fail to parse, and that is every stored cell in the country re-downloading the second heaviest thing the client streams.

One form keeps its own colour: the cycle path. The register describes construction and never colour, and a Dutch cycle path is dyed red whether it was laid in asphalt or in brick — asfalt being the commonest thing the survey says about one. Letting the material speak there would turn the most recognisable surface in the country grey along every street. The price is the occasional genuinely grey cycle path drawn red, which is much the cheaper error.

Kerbs and worn edges come from the boundaries, not from a register (2026-10-06)

The BGT has no kerbs in it — weginrichtingselement_lijn is all molgoot — but it is a partition, so the line between a pavement and the street beside it is surveyed. cartopolis_geo::paving_edges reads that line: where a raised surface (footway, island, verge, steps) borders a street, road or parking bay, a 15 cm kerbstone band is cut out of the raised side; where hard paving borders surveyed green (verge, or a grass or planting material), a 35 cm band is cut out and shaded per vertex from soil at the line to the paving's own tone. Not along a woonerf (level by design) or a driveway (dropped kerb). Which side is outside is probed, not taken from the winding — the doors' lesson.

Measured on cell 14/8490/5321 (central Groningen, 4,919 surfaces): 7,660 pieces, ~66 km of kerb and ~10 km of worn edge, 0.7 s on a debug build on the mesh worker. The plan of the bus station there lines up with the aerial photo: every platform kerbed all round, no kerb where pavement meets cycle path. paving_edges::real_cell::plan_of_a_real_cell (ignored) redraws that plan from any cell file.

The kerb stands 10 cm proud as a stone, not as a step. kerb_lines returns the same runs moved half a kerb onto the raised side, and map_geometry meshes them as LineKind::Kerb boxes with the walls — exactly over the flat band, never as colliders. Lifting the pavement itself was rejected: it would bury the verge's grass blades and sink every lamppost and bench standing on it, and put the paving off its rung on the ground stack. So from the road side a kerb reads right, and from the pavement it is a 10 cm lip it should not be.

One thing is deliberately not done yet: the worn edge only sees BGT green — a pavement beside an OSM park fill gets none, because that fill is not in the list the pass reads.

What is not read, and why

The other forty-two collections, gone through once

The BGT publishes 49 collections and the layer above reads seven. All 49 were measured on 2026-08-29 — one page (limit=1000) each over 1 km² of central Groningen (bbox=6.5590,53.2149,6.5740,53.2239), and a second page over roughly 10 × 9 km of the city (bbox=6.4800,53.1800,6.6300,53.2600) for the ones the small box returned empty. Current versions only, i.e. after the termination_date filter.

Every "over the city" number below is one page, so it is a floor and not a count. The API returns no total, so a collection whose page came back full at 1000 features has more behind it than the figure says — bord, put, paal, spoor and the terrain parts are all in that state. The figures are the right order of magnitude for deciding whether a collection is worth reading, and the wrong thing to size a cache against.

Two facts confirmed while doing it, and they are what a "should we?" question actually turns on: the interface is unchanged (https://api.pdok.nl/lv/bgt/ogc/v1, keyless, cursor-paged, no numberMatched, every historical version returned), and the licence is CC0 1.0, stated by the API itself in the collections document's license link. Caching and redistributing the cells is unambiguously allowed; the attribution line in surveyed.rs is courtesy, not obligation.

type is not the classifier for optional content — plus_type is

This is the trap, and it is the one that would silently delete a whole layer. The core BGT collections carry their class in type. The optional ones (IMGeo "plus" content) carry type: "niet-bgt" on every feature and put the real class in plus_type. Measured:

Collectiontypeplus_type
scheiding_vlakmuur 140, kademuur 71, transitie 12empty on all 223
bordniet-bgt on all 843verkeersbord 629, wegwijzer 80, informatiebord 52, verklikker transportleiding 34, scheepvaartbord 20, straatnaambord 17, plaatsnaambord 10
kastniet-bgt on all 162elektrakast 75, openbare verlichtingkast 29, CAI-kast 24
bakniet-bgt on all 34afvalbak 15, container 11, afval apart plaats 7
vegetatieobject_lijnniet-bgt on all 33haag 32

So "drop everything that is niet-bgt" is not a filter, it is a way to read nothing. Four of the five collections worth reading are niet-bgt end to end. The rule is per-collection: read type where the register fills it, plus_type where it does not, and drop a feature only when both are empty.

This also corrects a claim this note used to make: scheiding_vlak's type was said to be "empty on every feature seen so far". It is filled on all 223 current features over that 1 km². It is plus_type that is empty there.

Central Groningen has no surveyed point objects at all

Over that same 1 km² box, every point collection returns zero current features: paal, straatmeubilair, bak, bord, put, kast, mast, sensor_punt and vegetatieobject_punt. The wider city has all of them. It is not a bbox mistake: the same box returns 331 begroeidterreindeel, 816 onbegroeidterreindeel, 223 scheiding_vlak and 97 vegetatieobject_vlak, so the query works and the area is well surveyed — it is the point registers specifically that are absent. This is the same municipality-level coverage hole recorded above for trees, except that it is wider than trees: it is every point collection there is. The densest part of the city is the part with no surveyed street objects in it, so a capture of the centre is the wrong place to check whether any of this arrived.

Worth reading: five

Each has to clear the same four bars — nothing the client already reads supplies it, furniture.rs already has an honest form for it, it is visible at the scale the layer is drawn at, and it goes beside the generated layers rather than replacing them.

CollectionGeometryCurrent, measuredForm
scheiding_vlakPolygon223 over the 1 km²LineKind::Wall
vegetatieobject_lijnLineString33 over the cityLineKind::Hedge
bordPoint≥843 over the cityFurnitureKind::Board
kastPoint162 over the cityFurnitureKind::Cabinet
bakPoint34 over the cityFurnitureKind::Bin / Recycling

Two shape notes. scheiding_vlak is boundaries surveyed as areas, so it takes the same centreline reduction the area hedges take — laying boxes round the outline would draw both faces of every wall. Its kademuur and transitie are dropped: kademuur for exactly the reason scheiding_lijn already drops it (a metre of masonry along every canal, on the side the map draws as a bank), and transitie because it is a joining segment between two boundaries rather than a boundary. vegetatieobject_lijn, by contrast, is a hedge already surveyed as a line, so it skips that reduction and reaches LineKind::Hedge directly.

Open, and deliberately not decided here: verkeersbord. 629 of the 843 bord records are traffic signs. FurnitureKind::Board is an information board on two posts, and a traffic sign is a plate on one pole — drawing 629 of the first where the second stands is exactly the "wrongly styled thing" this note keeps arguing against, and at a density where it would be the first thing anyone noticed. The honest subset is wegwijzer, informatiebord, straatnaambord, plaatsnaambord and reclamebord, which is about 160 over the city — still worth reading. So either bord is taken as that subset, or verkeersbord waits for a sign form of its own. Either way it is not a reason to hold up the other four collections.

The client half of this has landed; the extractor half has not. PROP_KINDS in surveyed.rs now names positions 7 Board, 8 Bin, 9 Recycling — the forms bord and bak need, kast reusing position 6 Cabinet, and scheiding_vlak and vegetatieobject_lijn reusing LINE_KINDS 1 Wall and 2 Hedge, so LINE_KINDS did not move. That order is deliberate and is the only safe one across this seam: a client naming a form no host sends costs nothing, while a host sending a position no client has is content that vanishes with no error anywhere. Atlas's pipeline/bgt.rs must match those positions exactly when the walk is added there.

bak is read since 2026-10-05, with two straatmeubilair types beside it (positions 10 BikeRack and 11 Toilet). afvalbak → Bin; afval apart plaats and container → Recycling; fietsenrek → BikeRack; openbaar toilet → Toilet. bord and kast are still not read. Measured that day, one page per box, current versions only (both end dates empty):

Boxfietsenrekafvalbakafval apart plaatsopenbaar toilet
Den Haag centre398365420
Eindhoven centre1603491980
Groningen, whole city141450
Amsterdam centre8513223
Utrecht centre042340

Coverage is the municipality's choice, as with the trees, so these are added and never substituted. Where OSM's pois maps the same object, the surveyed copy stands and the pois one is dropped (furniture::drop_surveyed_twins, same form within 2.5 m) — benches were being drawn twice before this. A bike rack is drawn empty: the register says where it stands, not how full it is.

Not worth reading: the rest

One near miss, recorded so the next pass does not have to find it again: waterinrichtingselement_punt is 906 features in one page over the city, 898 of them meerpaal — mooring posts along the canals. That is more numerous than the five accepted collections put together, and it is rejected only because there is no form for a short post: FurnitureKind::Lamp is a column with a head on it and nothing else here is close. It is the obvious partner for crate::moorings, which currently infers where a boat could tie up from the shape of the water polygon and would rather be told.

The carriageways are not in either list because they are settled elsewhere: wegdeel's rijbaan *, spoorbaan and OV-baan stay with OpenStreetMap for the reason crates/geo/src/paving.rs gives.

What has not been measured

The per-cell byte cost of the five. Paving is already the second heaviest thing the client streams at 3.8 MB for the densest cell; these five go into the objects file, 60 kB for that same cell. The measurement is a full extractor run over the 1 km² box and du -b on the produced bgt/14/*/*.json, and it wants doing before the pipeline is run at scale.

Whether a client that has already visited a city would ever see the new content. It would not, as things stand: load_surveyed_cell returns the cached copy whenever one exists, and the coverage manifest carries no data version — zoom, cells, attribution, and CoverageSlot::revision can only change once per process. So re-running the extractor reaches only clients that have not been there yet. The three ways out are to accept it and let cache eviction handle it, to put a version in coverage.json and mix it into the cache key (a change to the shared CoverageSlot, so to every layer that uses one), or to serve new content under a new path so the old keys simply miss. That is a decision, not a detail.