cartopy: server/pipeline/brp.ts — the extractor half of the crop parcels #204
Labels
No labels
agent
agent:ci
agent:done
agent:failed
agent:needs-input
agent:refined
agent:refining
agent:running
agent:shipped
agent:skip
autonomous
autopilot
driven
local
plan
proposal
qa
qa-gap
research
retro
ship
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jeroen/cartopolis#204
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The client half of the RVO crop parcels landed in
jeroen/cartopolis(issue #203, branchfeat/203-brp-crop-parcels). It draws nothing until a host serves/brp/coverage.jsonand per-cell files, and that extractor lives in cartopy —server/pipeline/brp.ts, besidebgt.ts, plus an entry inserver/pipeline/format.test.ts.Filed here rather than on
jeroen/cartopybecause this container cannot reach that repository:FORGEJO_TOKENanswers 404 onrepos/jeroen/cartopyandgit ls-remotesays "Repository not found". Please move it, or hand it to a session that has the credentials.Source
https://api.pdok.nl/rvo/gewaspercelen/ogc/v1, collectionbrpgewas. Keyless, OGC API Features,bboxquery, GeoJSON out.category,gewas,gewascode,jaar,status.Wire format the client already parses
Cells binned at z14, on the parcel's centroid — one cell owns a parcel and draws it whole, including the vertices that fall outside (22–24 % of parcels leave their own cell, so binning by containment would delete a quarter of the country's fields).
/brp/coverage.json— the usual manifest:{"zoom": 14, "cells": [[x, y], …], "attribution": "…"}./brp/14/{x}/{y}.json:categoryis an index into this table, append, never renumber:GraslandBouwlandNatuurterreinBraaklandOverigeLandschapselement— never emit, reserved and non-drawablegewascodeis the register's own crop number, verbatim, as an integer.Rings are
[lat, lng]pairs, outer ring first, holes after, open (no repeated closing vertex). An outer ring under three points is dropped by the client.Landschapselementfeatures are filtered out by the extractor: 60 % of the features are landscape elements, and 316 of 340 sampled areSloot(ditches), which the Shortbread water layers already draw. Drawing them as land fills puts ground where the register says water.Simplify with Douglas–Peucker at 0.5 m — it keeps 31–32 % of the vertices, taking the heaviest cell measured to ~40 KB of coordinates.
The register serves one year (
jaar: 2025,status: "Definitief") with no superseded versions, so there is no BGT-style ghost-version filter to write. The client folds exact duplicates anyway.The client side is
crates/cartopolis/src/systems/map/crops.rs(parse_crop_cell,CATEGORIES) andcrates/geo/src/crops.rs(CropCategory,rgb), anddocs/notes/crop-parcels.mdhas the measurements and the method.Done when
server/pipeline/brp.tsproduces the coverage manifest and per-cell files above, driven from the Data tab like the other four.server/pipeline/format.test.tspins the shape against a capture of a real run, as it does forbgt,bag,lod22andbuildings.crop_parcels > 0in--dump-state, and a--flickerrun over the same view holds — the newSurfaceGroup::Croprung is 32 ULP fromGrassand has never been rendered against real data.QA of the client half (#217) built a stand-in for this extractor and ran it against the live service, so the wire form is now confirmed end to end rather than only unit-tested. What the client accepted, first try:
GET /brp/coverage.json—{"name", "zoom": 14, "attribution", "cells": [[x, y], ...]}, exactly the shapeCoverageSlotreads forbgt/bag.GET /brp/14/<x>/<y>.json—{"parcels": [[category, gewascode, [ring, ...]], ...]}with rings as[lat, lng]pairs, outer first, open (GeoJSON's repeated closing vertex has to go), andcategorythe index intoCATEGORIESinsystems/map/crops.rs(Grasland0 …Overige4;Landschapselement5 is reserved and dropped).Counts reproduce the note's table on the two z14 cells it measured: 199 features over Flevoland 8449/5374 and 308 over Groningen 8488/5315, with 79 and 186 of those
Landschapselement. Un-simplified those cells serialise to 48 KB and 243 KB; Douglas–Peucker at 0.5 m is what the note's ~40 KB assumes, so it is worth keeping in the port.One thing to decide while writing it: #222 asks for the crop's name to be reachable in the UI, and the cheapest source is this extractor passing the register's own
gewasstring per parcel. Worth settling before the wire form is fixed by a deployed host.