garage44.eu/jeroen/cartopolis

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

.. /docs/notes/crop-parcels.md

raw


topic: crop-parcels triggers: [crops.rs, brp.rs, BRP, gewaspercelen, gewascode, RVO, brpgewas, "crop parcels", "farmland", SurfaceGroup::Crop, turf.rs, arable] updated: 2026-09-27

Crop parcels (RVO BRP)

Every agricultural field in the Netherlands with the crop grown on it that year, from the RVO's Basisregistratie Gewaspercelen. cartopolis_geo::crops is the pure half, systems::crops the streaming half, and the extractor is atlas's crates/atlas/src/pipeline/brp.rs (dataset brp, written 2026-09-26; the TypeScript pipeline, where it was meant to go, never had one). The layer draws nothing for an area until that dataset has been run over it.

The interface, and what it costs

https://api.pdok.nl/rvo/gewaspercelen/ogc/v1 — one collection, brpgewas, OGC API Features, keyless, bbox query, GeoJSON out (storage CRS EPSG:28992, CRS84 offered). Note the path: there is no brpgewaspercelen under /rvo/.

Licence: Public Domain Mark 1.0, named by the collections document itself (creativecommons.org/publicdomain/mark/1.0/deed.nl). Caching and redistributing what we serve needs nobody's agreement.

One year is served — jaar: 2025, status: "Definitief", snapshot 15 May — with no superseded versions in the response, so this does not have the BGT's ghost-version trap (systems::surveyed). The parser folds exact duplicates anyway, because a cached cell outlives the extractor that wrote it.

Measured 2026-08-30 by curl against the live service, one request per exact z14 cell (the zoom map_geometry streams at):

CellFeaturesGeoJSONVerticesDrawn (crop) features / vertices
8488/5315, farmland N of Groningen308921 KB22,824122 / 13,220
8449/5374, Flevoland arable199232 KB4,954120 / 3,475
8490/5320, Groningen Grote Markt01 KB00 / 0

Douglas–Peucker at 0.5 m keeps 31–32 % of the drawn vertices, so the heaviest cell measured is ~40 KB of coordinates — against the 3.8 MB of surveyed paving that is already the second-heaviest thing this client streams. Volume was never the obstacle. Zero inside the city and zero outside the Netherlands is the degrade-to-nothing shape the other streamers have.

The frontier row's own figures (163 parcels / 501 KB) do not reproduce on a z14 cell; the table above replaces them.

Two things about the data that decide the implementation

Most features are not crops. Over the Groningen cell 186 of 308 are Landschapselement, and 316 of 340 of those sampled over the wider box are Sloot — ditches. Those are water, and Shortbread's water_polygons / water_lines already draw them; filling one with land puts ground where the register says there is none. So CropCategory has no variant for it, the wire position is reserved and non-drawable, and the parser drops the record. Category counts across four sampled regions: Landschapselement 1616, Grasland 1428, Bouwland 728, Natuurterrein 226, Braakland 1, Overige 1.

Parcels straddle cells, so the paving's binning rule cannot be copied. surveyed_paving drops any surface whose outer ring leaves its cell. Measured 2026-08-30, binning each parcel to the cell containing its centroid and then asking whether any vertex falls outside that cell: 22 % over the Groningen farmland cell and 24 % over Flevoland. Copying the rule would delete a quarter of the country's fields. The first extractor-less design drew each parcel whole from the cell owning its centroid; since 2026-09-27 the extractor cuts a parcel along every cell edge it crosses (brp::pieces, exact because a cell edge is a line of constant latitude or longitude) and each cell gets its own piece. The reason is the partition below: a cell can only cut its grass out from under fields it has been told about, and an overhang from the neighbour was grass left under a field. Over the Groningen area that is 2,573 parcels → 3,015 pieces across 51 cells.

The honest limit

Over the Groningen farmland cell 94 % of the parcel area is Grasland, and about half the country's agricultural area is grassland nationally. That is green repainted a more accurate green: half the countryside gains a confirmed fact and very little picture. Where it does change the picture it changes it a lot — over the Flevoland cell 93 % of the parcel area is Bouwland carrying 33 distinct crops, all of it drawn in one palette::GRASS before this.

The crop tones are a curated subset, deliberately

crops::rgb maps ~60 gewascodes to fourteen families; everything else falls back to the parcel's category tone, because the register carries several hundred codes and adds more each year, and an unlisted one must never take a neighbouring crop's colour (the rule land_group follows for an unlisted OSM kind). The curated set came from a national sample — eight bboxes, 2026-08-30 — ranked by area: permanent grassland 18 %, consumption potato 12 %, nature 9.5 %, ley 8.6 %, winter wheat 5.3 %, maize 5.3 %, sugar beet 4.2 %, then a long tail. Every code in the table was read off the live service; one that looks like it belongs to a family but was not observed is absent rather than guessed.

No season. A tulip field is red for a fortnight in April; the register records the crop, not the flower. Every tone is a year-round one, and the bulb fields are the sandy soil they stand in.

The tones were too pale to tell apart, and are not any more. The first palette kept every crop in the map's pale cartographic range, so potatoes (#C1D1A2), maize (#B4C595) and pasture (#C9DBBB) read as one green on the first real capture (2026-09-26, Deck). Since 2026-09-27 the tones are taken from aerial imagery, like the rest of the ground (land-cover.md), and each arable family is at least 30 apart in RGB from every other and from pasture — the_crop_families_can_be_told_apart holds the distance.

A palette alone cannot vary the Groningen countryside. Counted 2026-09-27 over the whole coverage (51 cells): 2,524 of 3,015 pieces are one crop, permanent pasture (265), then 228 natural grassland (331), 99 ley (266), 39 code 1926 and 22 maize. So crops::field_rgb leans each field drier or lusher off a hash of its first vertex (field_seed, micro-degrees, so the mesh and the basemap derive the same seed). The ends mirror each other about 1.0, so a run of fields averages back to the crop's tone. Grassland takes the full swing; other categories take a third of it. A parcel the extractor cut at a cell edge is two pieces with two seeds, and so can change shade along that edge. The fix is a parcel id on the wire, which the extractor does not write yet.

Depth, and why the ladder was not enough

SurfaceGroup::Crop sits at rung 2.5, half a step above Grass and below Forest. That held nothing once relief was on: measured on the Deck on 2026-09-26, every field drew in blotches of its own tone and the grass under it, because each sheet is bent onto the measured ground against its own triangles and the two disagree by up to CREASE_SAG_M (the-ground-stack.md). So since 2026-09-27 the overlap is removed rather than ordered: cartopolis_geo::crops::cut_into_ground cuts every sheet above Crop (woods, sand, water, paving, the road sheet) out of the parcels, and the parcels out of Built and Grass. The rung is now the backstop the ground-stack note says a rung is.

Seen from above

Above map_geometry::FLAT_GROUND_ON_M (250 m) the ground is the basemap image rather than meshes, and that image is painted from the vector tile alone — so until 2026-09-27 every field went back to one green on the way up, which is most of the altitudes anyone looks at farmland from. tile_loader now loads the parcel cells under each basemap source tile of z12–z14 (crops::raster_overlay) and vector_tiles::render_mvt_overlaid paints them straight after the land layer, under water, streets and buildings. Two things travel with it: the parcels are part of the rendered-tile cache key (a tile drawn before the host served the register must not be read back afterwards), and map_stream holds its first dispatch until the coverage manifest has answered, up to crops::RASTER_WAIT_S (3 s) — the same wait map_geometry gives its cells. z11 and coarser get no fields: 64 cells a tile, for one-pixel specks.