garage44.eu/jeroen/cartopolis

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

.. /docs/notes/data-layers.md

raw


topic: data-layers triggers: [crates/atlas/src/feeds.rs, formats/feeds.rs, systems::feeds, lib_feeds.rs, "Layers ▸ Data", LayerCategory, TripleXL, triplexl, "data layer", datalaag] updated: 2026-11-30

Data layers: records from outside, placed by atlas

Built 2026-11-30 from docs/mockups/data-layers/ (v1): points from TripleXL's saved queries, followed as the source commits; Layers ▸ Data, the dot and its card; and Admin ▸ Data layers on cartopolis.org. What the code does not say:

Why atlas fetches and the app never talks to the source

A source has a rate limit (TripleXL: 600 requests a minute per token), may want a token for a private dataset, answers in its own CRS (the water boards' are RD, EPSG:28992), and is not on our origin, so the browser build would need a proxy per source. atlas asks once per layer and serves cells like every other tree; a phone never meets any of that. The same rule as data-tooling-lives-in-atlas: served data comes from atlas.

Why the cells carry stamps, and a layer its own manifest

Each layer is a tree feeds/{id}/14/{x}/{y}.json under a stamped coverage.json (atlas::stamped, the building designs' scheme). A refresh writes only the cells whose bytes changed and gives only those a new stamp, so the client — which keys its cache on the stamp — fetches nothing after a refresh that found nothing new, and one cell after a commit that touched one record. For that to hold the bytes must not wobble: records are sorted, and coordinates rounded to 1e-6° (0.1 m), because a source's answer order is not promised and an RD → WGS 84 conversion's last digits are not stable.

A colour is an index, the palette is the client's

atlas ranks a layer's colour column by frequency and keeps the top seven (formats::feeds::MAX_VALUES); the rest are "other". A record carries the index. The palette (feeds::PALETTE) is the client's, so a theme change does not need a re-run.

TripleXL, as measured 2026-11-30

Not built yet

Lines and areas (the WKT parser places points only, and counts the rest as unplaced); queries that ask for a value; private datasets behind a token.

Looking at it without a deployed atlas

FEEDS_SITE=/tmp/site cargo test -p cartopolis_atlas live_stand_in -- --ignored writes three real layers as atlas publishes them. Serve /feeds/* from that tree and the rest from the data host, point CARTO_3DBAG_URL at it, and capture with --ui layers,datalayers,feeds (the tab, every layer on) or --ui feedcard (the card of the dot nearest the middle).