garage44.eu/jeroen/cartopolis

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

.. /docs/notes/tree-silhouettes.md

raw


topic: vegetation triggers: [tree_form.rs, TreeForm, TREE_FORMS, from_taxon, tree_forms, LATIJNSE_NAAM, "tree model", "tree models", "tree species", boomsoort, build_vegetation_meshes, push_trunk, "leaf_type", genus, plant_woods, WoodKind, WOOD_KINDS, begroeidterreindeel, naaldbos, loofbos, "gemengd bos", surveyed_woods, tree_models, update_tree_models, chunked_meshes, "tools/tree-models", "assets/models/trees", VisibilityRange, GltfMaterial] updated: 2026-11-07

A tree is drawn by its species

Until 2026-11-07 every tree in the client was one lumpy ball of 18 vertices on a square post. Height and width varied; the shape never did, so a canal lined with limes, a row of Lombardy poplars and a stand of spruce were the same object at three sizes. cartopolis_geo::tree_form now gives each surveyed tree one of seven silhouettes, chosen by its species.

The species is in the data, for nearly every street tree

Groningen's tree register (geo-data:Bomen gemeente Groningen) carries BOOMSOORT, LATIJNSE_NAAM, KIEMJAAR and MONUMENTAAL beside the height band atlas already read. Fetched whole on 2026-11-07: 126,016 trees, 155 without a Latin name. Through TreeForm::from_taxon they come out as:

formtrees
broad (oak, ash, maple, lime, elm, plane …)96,855
upright (birch, alder, rowan, pear …)21,098
columnar ('Fastigiata', 'Italica', 'Columella' …)3,186
conical (spruce, thuja, larch, metasequoia …)2,849
pine991
weeping (Salix sepulcralis, 'Pendula' …)787
none (Verwijderd, empty)250

The cultivar decides before the genus does — a 'Fastigiata' oak is a column — and is read only between the quotes, because Betula pendula, the silver birch, is a species name and does not weep. OSM's natural=tree gives the same name in species / taxon / genus where somebody mapped it, and the client reads it there; leaf_type=needleleaved alone still makes a conifer.

The BGT registers a street tree as plus_type = boom and nothing more: no species and no height, anywhere in the country, so every BGT tree stays Round, the old ball vertex for vertex.

A wood is planted by its kind

The vector tiles' woods and parks are areas with no trees in them, which the scatter fills. What the BGT does say is what grows in a wood: begroeidterreindeel.fysiek_voorkomen is loofbos, naaldbos or gemengd bos (seen live on the Veluwe and south of Groningen, 2026-11-07). Atlas writes those outlines into the BGT objects file as woods (formats::bgt::Wood), to every cell an outline's bounds reach, since a wood is often larger than a cell; the client asks of each scattered tree which wood it stands in (scatter::plant_woods).

The kind gives a proportion, not a species: a conifer wood is 70 % pine and 30 % cone, a mixed one half broadleaf and half that (WoodKind::form has the reasoning). A broadleaf wood stays the ball, because its species are unknown and a wood cell scatters up to 6,000 trees: the ball is the cheapest crown there is. A conifer wood costs about twice the old vertices (pine 36, cone 42). Like the species, nothing shows until atlas re-runs bgt on the host.

What it costs

Round is 18 vertices and 32 triangles; the largest form, Broad, three lobes of the same sphere, is 54 and 96; the lathes (columnar, weeping, conical) are 34–42 vertices. The trunk went from a 4-sided post (16 vertices) to a 6-sided tapering one (24), on every tree. Only surveyed trees take the dearer crowns — a dense Groningen cell carries a few thousand — and the mesh builder still cuts each cell's crowns to the frame's upload ceiling, now by each tree's own size rather than one per-tree constant. tree_form::tests::crowns_stay_small holds the ceiling at 54 vertices.

The species rides in a key of its own

The register cell file (formats::registers) carries tree_forms, one slug per tree, beside trees, rather than a fourth element in each tree row. serde_json refuses an array longer than the tuple it reads into, so a fourth element would have made every installed client — the phone's APK included — throw away the whole cell, lamp posts and parking bays with the trees, the first time atlas re-ran. An unknown key is ignored. A list that does not pair up with the trees is ignored too (Cell::tree_form), since pairing half a list would put every species on its neighbour.

Nothing changes on screen until atlas re-runs registers on the host — the deploy ships the binary, not the data (atlas.md).

Real models up close (desktop only)

Since 2026-11-07 the desktop rung draws a tree within ~140 m as a real model (systems::tree_models, assets/models/trees/, regenerated by tools/tree-models/gen.ts from EZ-Tree presets): the full model under 50 m, a light one beyond, the crowns above past the chunk switch. Phone and browser keep the crowns (quality::Budget::tree_models).

Things that cost an afternoon each: