--- 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 - `GET /datasets/{account}/{dataset}/queries/{name}` with `Accept: application/sparql-results+json` runs a saved query **without a token** on a public dataset. `/public` lists the public datasets and their saved queries; a query meant as a map has `view.kind = "map"` (optionally `view.colour`, the column its colours follow). - Geometry is a GeoSPARQL `wktLiteral` with the CRS IRI in front: ` POINT(233337.2 582870.6)`. GeoSPARQL's axis order matters: no IRI or CRS84 is longitude first, EPSG 4326 latitude first (`feeds::place`). - `stuwen-kaart` of Noorderzijlvest answered 1,578 rows in 0.15 s; `meldingen-kaart` of Hunze & Aa's 4,085. - It announces commits as a stream (`text/event-stream`) and as signed webhooks (`/capabilities`, `changeFeed`), and `GET {dataset}` answers its `revision`, which moves with every commit. **atlas follows a layer by that revision**: once a minute, one request per dataset, and a refresh when it moved. Webhooks were not chosen because registering one needs write rights on the dataset, which a reader does not have; the stream is a connection per dataset to keep open for an answer one small poll gives within a minute. ## 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).