garage44.eu/jeroen/cartopolis

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

cartopolis-agent · 2026-11-30T18:30:07Z

feat(app): Layers ▸ Data, the data layers atlas publishes

A seventh category in the Layers panel lists every layer in atlas's
feeds/index.json under its publisher, with the route and licence under
each name, a switch per layer with its record count, and the key of a
layer that is on. The switches persist in LayerPrefs.feeds by id.

systems::feeds reads the index while the tab is open or a layer is on,
polls each layer's stamped manifest every two minutes, and fetches the
cells round the stream centre whose stamp moved, cached under the stamp;
from 15 km up nothing is fetched or drawn. Records are fixed-size dots
over the map, coloured by the layer's colour column from a content
palette, and a tap opens a card made from the layer's definition: its
name and the record's value, the title, the fields, where it comes from
and a link to the record itself (lib_feeds).

docs/notes/data-layers.md has why atlas fetches, why cells carry stamps,
and what TripleXL answered when measured.
crates/cartopolis/src/systems/dev/shot_harness.rs |   4 +-
 crates/cartopolis/src/systems/dev/ui_probe.rs     |   7 +
 crates/cartopolis/src/systems/gui/data_layers.rs  |   3 +
 crates/cartopolis/src/systems/gui/feeds.rs        | 643 ++++++++++++++++++++++
 crates/cartopolis/src/systems/gui/layer_tiles.rs  |   6 +-
 crates/cartopolis/src/systems/gui/lib_feeds.rs    | 272 +++++++++
 crates/cartopolis/src/systems/gui/lib_layers.rs   | 185 ++++++-
 crates/cartopolis/src/systems/gui/mod.rs          |   3 +
 crates/cartopolis/src/systems/gui/plugin.rs       |  15 +
 crates/cartopolis/src/systems/map/layer_state.rs  |   8 +-
 crates/cartopolis/src/systems/mod.rs              |   6 +-
 crates/cartopolis/src/systems/net/user_store.rs   |   3 +
 docs/notes/data-layers.md                         |  62 +++
 13 files changed, 1206 insertions(+), 11 deletions(-)

diff --git a/crates/cartopolis/src/systems/dev/shot_harness.rs b/crates/cartopolis/src/systems/dev/shot_harness.rs
index c4fe753a..f0887720 100644
--- a/crates/cartopolis/src/systems/dev/shot_harness.rs
+++ b/crates/cartopolis/src/systems/dev/shot_harness.rs
@@ -2819,7 +2819,9 @@ pub fn open_scripted_ui(
     }
     layers.panel_open = want("layers");
     // Which category the Layers panel opens on: `--ui layers,orbit`.
-    layers.category = if want("orbit") {
+    layers.category = if want("datalayers") {
+        crate::systems::layer_tiles::LayerCategory::Data
+    } else if want("orbit") {
         crate::systems::layer_tiles::LayerCategory::Orbit
     } else if want("under") {
         crate::systems::layer_tiles::LayerCategory::Under
diff --git a/crates/cartopolis/src/systems/dev/ui_probe.rs b/crates/cartopolis/src/systems/dev/ui_probe.rs
index ccc06aef..04ad954c 100644
--- a/crates/cartopolis/src/systems/dev/ui_probe.rs
+++ b/crates/cartopolis/src/systems/dev/ui_probe.rs
@@ -108,6 +108,13 @@ impl Plugin for UiProbePlugin {
                     .after(crate::systems::lib_main_menu::drive_lib_main_menu)
                     .before(crate::systems::lib_host::bridge_input),
             )
+            // Layers ▸ Data's dots and card, under the plans' marks.
+            .add_systems(
+                PostUpdate,
+                crate::systems::lib_feeds::drive_lib_feeds
+                    .after(crate::systems::lib_plans::drive_lib_plans)
+                    .before(crate::systems::lib_host::bridge_input),
+            )
             // The splash's images fade by their tint, which the library's
             // restyle would overwrite: after it.
             .add_systems(
diff --git a/crates/cartopolis/src/systems/gui/data_layers.rs b/crates/cartopolis/src/systems/gui/data_layers.rs
index 85d99624..55df46b8 100644
--- a/crates/cartopolis/src/systems/gui/data_layers.rs
+++ b/crates/cartopolis/src/systems/gui/data_layers.rs
@@ -462,6 +462,7 @@ impl DataLayers {
             plans_council: self.plans_council,
             plans_works: self.plans_works,
             plans_period: self.plans_period.key().to_string(),
+            feeds: self.feeds.clone().into_iter().collect(),
             vehicles,
             overlays: LAYER_DEFS
                 .iter()
@@ -565,6 +566,7 @@ impl DataLayers {
         self.plans_council = p.plans_council;
         self.plans_works = p.plans_works;
         self.plans_period = crate::systems::plans::Period::from_key(&p.plans_period);
+        self.feeds = p.feeds.clone().into_iter().collect();
         self.vehicles_enabled = p.vehicles;
         for (i, def) in LAYER_DEFS.iter().enumerate() {
             if let Some(on) = p.overlays.get(def.key) {
@@ -644,6 +646,7 @@ impl Default for DataLayers {
             plans_council: true,
             plans_works: true,
             plans_period: crate::systems::plans::Period::default(),
+            feeds: std::collections::BTreeMap::new(),
             category: crate::systems::layer_tiles::LayerCategory::default(),
             open_tile: None,
             terrain_revision: 0,
diff --git a/crates/cartopolis/src/systems/gui/feeds.rs b/crates/cartopolis/src/systems/gui/feeds.rs
new file mode 100644
index 00000000..288d3d2e
--- /dev/null
+++ b/crates/cartopolis/src/systems/gui/feeds.rs
@@ -0,0 +1,643 @@
+//! Layers ▸ **Data**: records from a source outside Cartopolis, placed on the
+//! map by atlas (`docs/notes/data-layers.md`; the design is
+//! `docs/mockups/data-layers/`, v1).
+//!
+//! atlas's `feeds` module asks the source (TripleXL's saved queries first) and
+//! publishes `feeds/index.json` — every layer, with what its tile and card
+//! need — and per layer a stamped `coverage.json` over z14 cells of records
+//! (`cartopolis_geo::formats::feeds`). Here:
+//!
+//! - [`drive_feeds`] reads the index while the Data tab is open or a layer is
+//!   on, polls each layer's manifest while it is on, and fetches the cells
+//!   round the stream centre whose stamp moved — a cached cell is good for
+//!   ever under its stamp, so a refresh that changed nothing costs a manifest
+//!   and no cells;
+//! - [`place_feeds`] projects the records in view to fixed-size dots over the
+//!   map, coloured by the layer's colour column, as the plans' notices are
+//!   (`systems::plans` says why a remark about a spot is a dot and not a
+//!   mesh), and opens the card a tap on one asked for;
+//! - the library draws the dots and the card (`lib_feeds`).
+//!
+//! With every layer off nothing is fetched or drawn.
+
+use std::collections::{BTreeMap, HashMap, HashSet};
+use std::sync::{Arc, Mutex};
+use std::time::Duration;
+
+use bevy::prelude::*;
+use bevy::tasks::IoTaskPool;
+use big_space::prelude::GridCell;
+use cartopolis_core::world::{lat_lng_to_tile, tile_to_meters};
+use cartopolis_geo::formats::feeds::{Feed, Index, Record};
+use cartopolis_geo::formats::CACHE_ZOOM;
+use web_time::Instant;
+
+use crate::components::FreeCamera;
+use crate::grid::{anchored_position_f64, AnchoredCamera};
+use crate::platform::{http, storage};
+use crate::resources::{MapAnchor, RightPanel};
+use crate::services::tdbag_url;
+use crate::systems::cell_ring;
+use crate::systems::globe::GlobeState;
+use crate::systems::layer_state::{DataLayers, LayerCategory};
+use crate::systems::map_stream::MapStream;
+use crate::systems::place_pins::{clear_of_chrome, map_area, place_delta};
+use crate::systems::theme;
+use crate::systems::ui_input::{UiInput, UiMetrics};
+
+/// Read the index again after this long.
+const INDEX_TTL: Duration = Duration::from_secs(10 * 60);
+/// Read a layer's manifest again after this long while it is on: what makes
+/// a layer current without a push.
+const MANIFEST_TTL: Duration = Duration::from_secs(2 * 60);
+/// After a failed read, wait this long before the next.
+const RETRY_AFTER: Duration = Duration::from_secs(60);
+/// Cells in flight at once, over every layer.
+const MAX_IN_FLIGHT: usize = 6;
+/// Above this the dots are not drawn and no cells are fetched: a record is a
+/// spot, and from higher up a layer is a smear.
+const MAX_ALTITUDE_M: f64 = 15_000.0;
+/// Dots drawn at most, over every layer.
+const MAX_DOTS: usize = 500;
+
+/// The colours a layer's values take, in the order atlas ranks them (most
+/// common first), and grey for "other". A content palette, the same in both
+/// themes, as the plans' dots are.
+pub const PALETTE: [theme::Rgba8; 8] = [
+    theme::Rgba8::from_rgb(0x5F, 0xB3, 0xE6),
+    theme::Rgba8::from_rgb(0xF2, 0xA3, 0x3A),
+    theme::Rgba8::from_rgb(0xB4, 0x8C, 0xF0),
+    theme::Rgba8::from_rgb(0x7F, 0xC9, 0xA0),
+    theme::Rgba8::from_rgb(0xE8, 0x89, 0x3C),
+    theme::Rgba8::from_rgb(0xE5, 0xD3, 0x6A),
+    theme::Rgba8::from_rgb(0xE5, 0x7A, 0xA0),
+    theme::Rgba8::from_rgb(0x9A, 0xA7, 0xAB),
+];
+
+/// The colour of value index `value` (−1: the layer has one colour).
+#[must_use]
+pub fn colour(value: i64) -> theme::Rgba8 {
+    match usize::try_from(value) {
+        Ok(i) => PALETTE[i.min(PALETTE.len() - 1)],
+        Err(_) => PALETTE[0],
+    }
+}
+
+/// A layer's key: its values with their colours, and "other" when some
+/// records fall outside them.
+#[must_use]
+pub fn key(feed: &Feed) -> Vec<(String, theme::Rgba8)> {
+    let mut out: Vec<(String, theme::Rgba8)> = feed
+        .values
+        .iter()
+        .enumerate()
+        .map(|(i, v)| (v.clone(), colour(i as i64)))
+        .collect();
+    if !out.is_empty() {
+        out.push(("other".into(), colour(feed.values.len() as i64)));
+    }
+    out
+}
+
+/// A manifest as last read: each covered cell's stamp.
+#[derive(Default)]
+struct Manifest {
+    cells: HashMap<(i64, i64), u64>,
+    read_at: Option<Instant>,
+    failed_at: Option<Instant>,
+    loading: bool,
+}
+
+/// What a background read brought back.
+enum Arrival {
+    Index(Option<Index>),
+    Manifest(String, Option<HashMap<(i64, i64), u64>>),
+    Cell(String, (i64, i64), u64, Option<Vec<Record>>),
+}
+
+/// The card a tap opened: the record, and the layer it is from.
+#[derive(Clone, Debug, PartialEq)]
+pub struct FeedCard {
+    pub feed: Feed,
+    pub record: Record,
+}
+
+/// One dot where it stands this frame, in UI points.
+#[derive(Clone, Debug, PartialEq)]
+#[cfg_attr(not(feature = "ui-lib"), allow(dead_code))]
+pub struct FeedMark {
+    /// Stable across frames: the layer, the cell and the record's place in it.
+    pub key: String,
+    pub at: Vec2,
+    pub title: String,
+    pub colour: theme::Rgba8,
+}
+
+/// The layers' state.
+#[derive(Resource, Default)]
+pub struct Feeds {
+    index: Option<Arc<Index>>,
+    index_read_at: Option<Instant>,
+    index_failed_at: Option<Instant>,
+    index_loading: bool,
+    manifests: HashMap<String, Manifest>,
+    /// Each fetched cell under the stamp it was fetched at.
+    cells: HashMap<(String, (i64, i64)), (u64, Arc<Vec<Record>>)>,
+    in_flight: HashSet<(String, (i64, i64))>,
+    inbox: Arc<Mutex<Vec<Arrival>>>,
+    /// The base tile the cell ring is reckoned from, and the anchor
+    /// generation it belongs to.
+    anchor: Option<((i64, i64), u32, f64, u32)>,
+    /// The card a tap opened.
+    pub card: Option<FeedCard>,
+    /// The dots over the map this frame, drawn by `lib_feeds`.
+    pub marks: Vec<FeedMark>,
+    /// The key of the dot the library's tap landed on, opened next frame by
+    /// [`place_feeds`].
+    pub lib_tapped: Option<String>,
+}
+
+impl Feeds {
+    /// Every published layer, as last read.
+    #[must_use]
+    pub fn list(&self) -> &[Feed] {
+        self.index.as_ref().map_or(&[], |i| i.feeds.as_slice())
+    }
+
+    /// The index could not be read and nothing was kept.
+    #[must_use]
+    pub fn failed(&self) -> bool {
+        self.index.is_none() && self.index_failed_at.is_some()
+    }
+
+    /// The index is being read for the first time.
+    #[must_use]
+    pub fn loading(&self) -> bool {
+        self.index.is_none() && self.index_loading
+    }
+}
+
+fn due(read: Option<Instant>, failed: Option<Instant>, ttl: Duration) -> bool {
+    if failed.is_some_and(|t| t.elapsed() < RETRY_AFTER) {
+        return false;
+    }
+    read.is_none_or(|t| t.elapsed() >= ttl)
+}
+
+/// Seconds since the epoch, coarse: a cache-buster that changes once a
+/// minute, so the data host's own caching still holds within one.
+fn minute() -> u64 {
+    web_time::SystemTime::now()
+        .duration_since(web_time::UNIX_EPOCH)
+        .map_or(0, |d| d.as_secs() / 60)
+}
+
+async fn read_index() -> Option<Index> {
+    let url = format!("{}/feeds/index.json?t={}", tdbag_url(), minute());
+    let bytes = http::fetch_optional(http::Request::get(url)).await.ok()??;
+    let text = String::from_utf8(bytes).ok()?;
+    cartopolis_geo::formats::feeds::parse_index(&text).ok()
+}
+
+async fn read_manifest(id: &str) -> Option<HashMap<(i64, i64), u64>> {
+    let url = format!("{}/feeds/{id}/coverage.json?t={}", tdbag_url(), minute());
+    let bytes = http::fetch_optional(http::Request::get(url)).await.ok()??;
+    let manifest = cartopolis_geo::formats::coverage::parse_slice(&bytes).ok()?;
+    Some(
+        manifest
+            .cells
+            .into_iter()
+            .map(|c| (c.xy(), c.stamp.unwrap_or(0)))
+            .collect(),
+    )
+}
+
+async fn read_cell(id: &str, (cx, cy): (i64, i64), stamp: u64) -> Option<Vec<Record>> {
+    // Keyed on the cell's stamp: a cached cell is good for ever under it, and
+    // a refresh that changed the cell is a new stamp, a new key and one fetch.
+    let key = format!("feeds/{id}/{stamp}/{cx}/{cy}.json");
+    let text = match storage::get_string(storage::Namespace::Cache, &key).await {
+        Some(t) => t,
+        None => {
+            let url = format!(
+                "{}/feeds/{id}/{CACHE_ZOOM}/{cx}/{cy}.json?v={stamp}",
+                tdbag_url()
+            );
+            let bytes = http::fetch(http::Request::get(url)).await.ok()?;
+            let text = String::from_utf8(bytes).ok()?;
+            storage::put(storage::Namespace::Cache, &key, text.as_bytes()).await;
+            text
+        }
+    };
+    cartopolis_geo::formats::feeds::parse_cell(&text)
+        .ok()
+        .map(|c| c.records)
+}
+
+fn spawn(inbox: &Arc<Mutex<Vec<Arrival>>>, work: impl std::future::Future<Output = Arrival> + Send + 'static) {
+    let inbox = inbox.clone();
+    IoTaskPool::get()
+        .spawn(async move {
+            let arrival = work.await;
+            if let Ok(mut i) = inbox.lock() {
+                i.push(arrival);
+            }
+        })
+        .detach();
+}
+
+/// How many cells round the centre to hold, by height: the view from a few
+/// kilometres up spans several.
+fn ring_radius(altitude_m: f64) -> i64 {
+    if altitude_m < 2_500.0 {
+        1
+    } else if altitude_m < 7_000.0 {
+        2
+    } else {
+        3
+    }
+}
+
+/// Read the index, the manifests of the layers that are on, and the cells
+/// round the stream centre whose stamp moved; drop what is out of reach.
+#[allow(clippy::too_many_arguments)]
+pub fn drive_feeds(
+    mut feeds: ResMut<Feeds>,
+    dl: Res<DataLayers>,
+    right_panel: Res<RightPanel>,
+    stream: Res<MapStream>,
+    camera: AnchoredCamera,
+    globe: Res<GlobeState>,
+) {
+    // What came back since the last frame.
+    let arrivals: Vec<Arrival> = feeds
+        .inbox
+        .lock()
+        .map(|mut i| std::mem::take(&mut *i))
+        .unwrap_or_default();
+    for a in arrivals {
+        match a {
+            Arrival::Index(index) => {
+                feeds.index_loading = false;
+                match index {
+                    Some(i) => {
+                        feeds.index = Some(Arc::new(i));
+                        feeds.index_read_at = Some(Instant::now());
+                        feeds.index_failed_at = None;
+                    }
+                    None => feeds.index_failed_at = Some(Instant::now()),
+                }
+            }
+            Arrival::Manifest(id, cells) => {
+                let m = feeds.manifests.entry(id).or_default();
+                m.loading = false;
+                match cells {
+                    Some(c) => {
+                        m.cells = c;
+                        m.read_at = Some(Instant::now());
+                        m.failed_at = None;
+                    }
+                    None => m.failed_at = Some(Instant::now()),
+                }
+            }
+            Arrival::Cell(id, cell, stamp, records) => {
+                feeds.in_flight.remove(&(id.clone(), cell));
+                if let Some(r) = records {
+                    feeds.cells.insert((id, cell), (stamp, Arc::new(r)));
+                }
+            }
+        }
+    }
+
+    let on: Vec<String> = dl
+        .feeds
+        .iter()
+        .filter(|(_, on)| **on)
+        .map(|(id, _)| id.clone())
+        .collect();
+    let browsing = right_panel.is(RightPanel::Layers) && dl.category == LayerCategory::Data;
+    if (browsing || !on.is_empty())
+        && !feeds.index_loading
+        && due(feeds.index_read_at, feeds.index_failed_at, INDEX_TTL)
+    {
+        feeds.index_loading = true;
+        spawn(&feeds.inbox, async { Arrival::Index(read_index().await) });
+    }
+
+    // A layer that is off, or gone from the index, lets go of what it held.
+    let published: HashSet<&str> = feeds.list().iter().map(|f| f.id.as_str()).collect();
+    let live: HashSet<String> = on
+        .iter()
+        .filter(|id| feeds.index.is_none() || published.contains(id.as_str()))
+        .cloned()
+        .collect();
+    feeds.manifests.retain(|id, _| live.contains(id));
+    feeds.cells.retain(|(id, _), _| live.contains(id));
+    if live.is_empty() {
+        return;
+    }
+
+    for id in &live {
+        let m = feeds.manifests.entry(id.clone()).or_default();
+        if !m.loading && due(m.read_at, m.failed_at, MANIFEST_TTL) {
+            m.loading = true;
+            let id = id.clone();
+            spawn(&feeds.inbox, async move {
+                let cells = read_manifest(&id).await;
+                Arrival::Manifest(id, cells)
+            });
+        }
+    }
+
+    let Some((clat, clng, base_zoom)) = stream.geo_anchor() else {
+        return;
+    };
+    let Some((cell, tf)) = camera.get() else {
+        return;
+    };
+    let altitude = globe.altitude_m(cell, tf);
+    if altitude > MAX_ALTITUDE_M {
+        return;
+    }
+    if feeds
+        .anchor
+        .is_none_or(|(_, _, _, generation)| generation != stream.anchor_generation)
+    {
+        feeds.anchor = Some((
+            lat_lng_to_tile(clat, clng, base_zoom),
+            base_zoom,
+            clat,
+            stream.anchor_generation,
+        ));
+    }
+    let (base, z, lat, _) = feeds.anchor.expect("set just above");
+    let tile_m = tile_to_meters(z, lat) as f32;
+    let centre = cell_ring::coarsen(
+        cell_ring::tile_at(base, tile_m, camera.stream_xz_at(cell, tf)),
+        z,
+        CACHE_ZOOM,
+    );
+    let r = ring_radius(altitude);
+    let near = |c: (i64, i64), reach: i64| {
+        (c.0 - centre.0).abs() <= reach && (c.1 - centre.1).abs() <= reach
+    };
+    // Kept a little past the ring, so a camera rocking at an edge does not
+    // fetch the same cell over and over.
+    feeds.cells.retain(|(_, c), _| near(*c, r + 2));
+
+    // Nearest first, over every layer that is on.
+    let mut wanted: Vec<(i64, String, (i64, i64), u64)> = Vec::new();
+    for id in &live {
+        let Some(m) = feeds.manifests.get(id) else {
+            continue;
+        };
+        for (&c, &stamp) in &m.cells {
+            if !near(c, r) {
+                continue;
+            }
+            let key = (id.clone(), c);
+            if feeds.in_flight.contains(&key) {
+                continue;
+            }
+            if feeds.cells.get(&key).is_some_and(|(s, _)| *s == stamp) {
+                continue;
+            }
+            let d = (c.0 - centre.0).abs().max((c.1 - centre.1).abs());
+            wanted.push((d, id.clone(), c, stamp));
+        }
+    }
+    // A cell the manifest no longer lists is empty now.
+    let listed: HashSet<(String, (i64, i64))> = feeds
+        .manifests
+        .iter()
+        .filter(|(_, m)| m.read_at.is_some())
+        .flat_map(|(id, m)| m.cells.keys().map(move |c| (id.clone(), *c)))
+        .collect();
+    let read: HashSet<&String> = feeds
+        .manifests
+        .iter()
+        .filter(|(_, m)| m.read_at.is_some())
+        .map(|(id, _)| id)
+        .collect();
+    let gone: Vec<(String, (i64, i64))> = feeds
+        .cells
+        .keys()
+        .filter(|k| read.contains(&k.0) && !listed.contains(*k))
+        .cloned()
+        .collect();
+    for k in gone {
+        feeds.cells.remove(&k);
+    }
+    wanted.sort();
+    for (_, id, c, stamp) in wanted {
+        if feeds.in_flight.len() >= MAX_IN_FLIGHT {
+            break;
+        }
+        feeds.in_flight.insert((id.clone(), c));
+        spawn(&feeds.inbox, async move {
+            let records = read_cell(&id, c, stamp).await;
+            Arrival::Cell(id, c, stamp, records)
+        });
+    }
+}
+
+/// Place the dots of the layers that are on, and open the card a tap on one
+/// asked for. After the dock and the camera, as the plans' dots.
+#[allow(clippy::too_many_arguments)]
+pub fn place_feeds(
+    mut feeds: ResMut<Feeds>,
+    dl: Res<DataLayers>,
+    globe: Res<GlobeState>,
+    camera: Query<(&Camera, &GridCell, &Transform), With<FreeCamera>>,
+    terrain: Res<crate::systems::terrain::TerrainField>,
+    map_anchor: Res<MapAnchor>,
+    keyboard: Res<crate::systems::onscreen_keyboard::OnScreenKeyboard>,
+    lens: Res<crate::systems::scenario::LensSlot>,
+    route: Res<crate::systems::navigation::RouteState>,
+    driver: Res<crate::systems::driver::DriverState>,
+    chrome: Res<crate::systems::dock::MapChrome>,
+    input: Res<UiInput>,
+    metrics: Res<UiMetrics>,
+) {
+    let tapped = feeds.lib_tapped.take();
+    let mut marks: Vec<(FeedMark, FeedCard)> = Vec::new();
+    let anchor = map_anchor.geo;
+    let cam = camera.single().ok();
+    if let (false, Some(anchor), Some((cam, cam_cell, cam_tf))) = (driver.active, anchor, cam) {
+        let in_space = globe.in_space(cam_cell, cam_tf);
+        let high = in_space || globe.altitude_m(cam_cell, cam_tf) > MAX_ALTITUDE_M;
+        if !high {
+            let map_rect = map_area(&input, &metrics, &keyboard, &route, &lens);
+            let cam_world = anchored_position_f64(cam_cell, cam_tf.translation);
+            // This frame's camera basis, not last frame's (`place_pins` says why).
+            let cam_view = GlobalTransform::from(Transform::from_rotation(cam_tf.rotation));
+            // Layer by layer in the index's order, so the stacking is stable.
+            let mut by_feed: BTreeMap<usize, Vec<(&(String, (i64, i64)), &Arc<Vec<Record>>)>> =
+                BTreeMap::new();
+            for (k, (_, records)) in &feeds.cells {
+                if !dl.feeds.get(&k.0).copied().unwrap_or(false) {
+                    continue;
+                }
+                if let Some(i) = feeds.list().iter().position(|f| f.id == k.0) {
+                    by_feed.entry(i).or_default().push((k, records));
+                }
+            }
+            'feeds: for (i, mut cells) in by_feed {
+                let feed = &feeds.list()[i];
+                cells.sort_by_key(|(k, _)| k.1);
+                for ((id, (cx, cy)), records) in cells {
+                    for (j, r) in records.iter().enumerate() {
+                        if marks.len() >= MAX_DOTS {
+                            break 'feeds;
+                        }
+                        let Some(delta) =
+                            place_delta(&globe, anchor, cam_world, in_space, r.0, r.1, &terrain)
+                        else {
+                            continue;
+                        };
+                        let Ok(screen) = cam.world_to_viewport(&cam_view, delta.as_vec3()) else {
+                            continue;
+                        };
+                        let at = metrics.window_to_ui(screen);
+                        if !map_rect.contains(at) || !clear_of_chrome(&chrome.holes, at) {
+                            continue;
+                        }
+                        marks.push((
+                            FeedMark {
+                                key: format!("{id}:{cx}:{cy}:{j}"),
+                                at,
+                                title: format!("{} · {}", r.2, feed.name),
+                                colour: colour(r.3),
+                            },
+                            FeedCard {
+                                feed: feed.clone(),
+                                record: r.clone(),
+                            },
+                        ));
+                    }
+                }
+            }
+        }
+    }
+    if let Some(card) = tapped
+        .and_then(|key| marks.iter().find(|(m, _)| m.key == key))
+        .map(|(_, card)| card.clone())
+    {
+        feeds.card = Some(card);
+    }
+    // A card whose layer was turned off goes with it.
+    if feeds
+        .card
+        .as_ref()
+        .is_some_and(|c| !dl.feeds.get(&c.feed.id).copied().unwrap_or(false))
+    {
+        feeds.card = None;
+    }
+    let marks: Vec<FeedMark> = marks.into_iter().map(|(m, _)| m).collect();
+    if feeds.marks != marks {
+        feeds.marks = marks;
+    }
+}
+
+/// The card's lines: the record's fields, each under its column's name,
+/// skipping the empty ones.
+#[must_use]
+pub fn card_rows(card: &FeedCard) -> Vec<(String, String)> {
+    card.feed
+        .fields
+        .iter()
+        .zip(card.record.4.iter())
+        .filter(|(_, v)| !v.trim().is_empty())
+        .map(|(k, v)| (k.clone(), v.clone()))
+        .collect()
+}
+
+/// The card's source line: who it is credited to, the route, the licence and
+/// when the source last changed.
+#[must_use]
+pub fn source_line(feed: &Feed) -> String {
+    let mut parts = vec![feed.credit.clone()];
+    if !feed.via.is_empty() {
+        parts.push(format!("via {}", feed.via));
+    }
+    if !feed.licence.is_empty() {
+        parts.push(feed.licence.clone());
+    }
+    if feed.changed_ms > 0 {
+        let date = cartopolis_core::plans::civil_date(feed.changed_ms / 1000);
+        parts.push(format!("changed {date}"));
+    }
+    parts.join(" · ")
+}
+
+/// The value a record's colour stands for, when the layer has a colour
+/// column.
+#[must_use]
+pub fn value_label(card: &FeedCard) -> Option<String> {
+    let i = usize::try_from(card.record.3).ok()?;
+    Some(
+        card.feed
+            .values
+            .get(i)
+            .cloned()
+            .unwrap_or_else(|| "other".into()),
+    )
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    fn feed() -> Feed {
+        Feed {
+            changed_ms: 1_764_288_000_000,
+            colour_by: "soort".into(),
+            credit: "Waterschap Noorderzijlvest open data".into(),
+            fields: vec!["code".into(), "soort".into(), "capaciteit".into()],
+            group: "Waterschap Noorderzijlvest".into(),
+            id: "nzv-stuwen".into(),
+            licence: "CC BY 4.0".into(),
+            name: "Stuwen".into(),
+            records: 2,
+            values: vec!["overlaat".into(), "stuw met klep".into()],
+            via: "TripleXL".into(),
+        }
+    }
+
+    #[test]
+    fn a_value_past_the_key_is_other_and_no_column_is_one_colour() {
+        assert_eq!(colour(0), PALETTE[0]);
+        assert_eq!(colour(99), PALETTE[7]);
+        assert_eq!(colour(-1), PALETTE[0]);
+        let k = key(&feed());
+        assert_eq!(k.len(), 3);
+        assert_eq!(k[2].0, "other");
+    }
+
+    #[test]
+    fn the_card_skips_empty_fields_and_names_its_source() {
+        let card = FeedCard {
+            feed: feed(),
+            record: (
+                53.22,
+                6.55,
+                "Hoge Noorderplantsoenstuw".into(),
+                0,
+                vec!["KST6211".into(), "overlaat".into(), String::new()],
+                String::new(),
+            ),
+        };
+        assert_eq!(
+            card_rows(&card),
+            vec![
+                ("code".to_string(), "KST6211".to_string()),
+                ("soort".to_string(), "overlaat".to_string())
+            ]
+        );
+        assert_eq!(value_label(&card).as_deref(), Some("overlaat"));
+        assert_eq!(
+            source_line(&card.feed),
+            "Waterschap Noorderzijlvest open data · via TripleXL · CC BY 4.0 · changed 2025-11-28"
+        );
+    }
+}
diff --git a/crates/cartopolis/src/systems/gui/layer_tiles.rs b/crates/cartopolis/src/systems/gui/layer_tiles.rs
index 907954db..96a5a2f2 100644
--- a/crates/cartopolis/src/systems/gui/layer_tiles.rs
+++ b/crates/cartopolis/src/systems/gui/layer_tiles.rs
@@ -8,13 +8,14 @@ use crate::systems::icons;
 pub use crate::systems::layer_state::LayerCategory;
 
 impl LayerCategory {
-    pub const ALL: [Self; 6] = [
+    pub const ALL: [Self; 7] = [
         Self::Map,
         Self::City,
         Self::Places,
         Self::Moving,
         Self::Under,
         Self::Orbit,
+        Self::Data,
     ];
 
     #[must_use]
@@ -26,6 +27,7 @@ impl LayerCategory {
             Self::Moving => "Traffic",
             Self::Under => "Below",
             Self::Orbit => "Space",
+            Self::Data => "Data",
         }
     }
 
@@ -38,6 +40,7 @@ impl LayerCategory {
             Self::Moving => icons::CAT_MOVING,
             Self::Under => icons::CAT_UNDER,
             Self::Orbit => icons::CAT_ORBIT,
+            Self::Data => icons::RECORD,
         }
     }
 
@@ -51,6 +54,7 @@ impl LayerCategory {
             Self::Moving => "Everything on the map that moves",
             Self::Under => "Opens the ground near you · Netherlands only",
             Self::Orbit => "The whole planet, seen from space",
+            Self::Data => "Records from open data, by who publishes them",
         }
     }
 }
diff --git a/crates/cartopolis/src/systems/gui/lib_feeds.rs b/crates/cartopolis/src/systems/gui/lib_feeds.rs
new file mode 100644
index 00000000..aca61b29
--- /dev/null
+++ b/crates/cartopolis/src/systems/gui/lib_feeds.rs
@@ -0,0 +1,272 @@
+//! Layers ▸ Data drawn by the component library (`lib_host`): each record in
+//! view as a dot over the map, and the card a tap on one opens
+//! (`docs/mockups/data-layers/`, v1, sheets 1a and 1b).
+//!
+//! The dots are placed by `feeds::place_feeds` (`Feeds::marks`) and drawn
+//! through `lib_pins::Anchored`, the keyed list everything anchored to the
+//! world goes through, under the plans' marks and the pins. A tap goes back as
+//! `Feeds::lib_tapped` and opens the card there. The card stands where the
+//! place card does, over the dock (`lib_place_card::Placement`), and is made
+//! from the layer's own definition: its name and colour, the record's title,
+//! the fields the layer shows, and the line saying where it is from.
+
+use std::cell::RefCell;
+use std::rc::Rc;
+
+use bevy::ecs::system::NonSendMarker;
+use bevy::prelude::*;
+// The library's, not Bevy's: an explicit import outranks the two globs.
+use mithril::prelude::*;
+use mithril::prelude::{Button, Event};
+
+use crate::systems::feeds::{card_rows, colour, source_line, value_label, FeedCard, Feeds};
+use crate::systems::lib_pins::{boxed, css, px_scale, Anchored, Spot};
+use crate::systems::lib_place_card::{icon, Placement};
+use crate::systems::lib_settings::LibScreens;
+use crate::systems::ui_input::UiMetrics;
+use crate::systems::{icons, theme};
+
+const CARD: &str = "feeds_card";
+const MARKS: &str = "feeds_marks";
+
+/// Under the plans' marks (-2) and the pins (-1), over the place names (-3):
+/// a record is background to a remark somebody made.
+const MARKS_Z: i32 = -2;
+/// A dot's radius and rim, in points.
+const DOT_R: f32 = 6.0;
+const RIM: f32 = 2.0;
+
+/// What a tap asked for; done by the system.
+#[derive(Clone)]
+enum Act {
+    Close,
+    Url(String),
+}
+
+/// A dot as drawn: everything but where it is.
+#[derive(Clone, PartialEq)]
+struct DotStyle {
+    title: String,
+    colour: theme::Rgba8,
+}
+
+/// The card as drawn.
+#[derive(Clone, PartialEq)]
+struct CardState {
+    place: Placement,
+    card: FeedCard,
+}
+
+struct Screens {
+    acts: Rc<RefCell<Vec<Act>>>,
+    dots: Anchored<DotStyle>,
+    tapped: Rc<RefCell<Option<String>>>,
+    card: Option<Signal<CardState>>,
+}
+
+thread_local! {
+    static MOUNTED: RefCell<Option<Screens>> = const { RefCell::new(None) };
+}
+
+fn on(acts: &Rc<RefCell<Vec<Act>>>, a: Act) -> Handler {
+    let acts = acts.clone();
+    Rc::new(move |_: &Event| acts.borrow_mut().push(a.clone())) as Handler
+}
+
+/// Mounts the dots once and mirrors `place_feeds`' frame of them; mounts,
+/// bridges and unmounts the card. `PostUpdate`, before `DriveUi`, as every
+/// library screen.
+pub fn drive_lib_feeds(
+    _main: NonSendMarker,
+    lib: Res<LibScreens>,
+    mut feeds: ResMut<Feeds>,
+    metrics: Res<UiMetrics>,
+) {
+    if !lib.pins {
+        return;
+    }
+    let size = metrics.viewport_pts();
+    let ui_scale = metrics.ui_scale();
+    let k = px_scale(ui_scale);
+    MOUNTED.with(|m| {
+        let mut m = m.borrow_mut();
+        let screens = m.get_or_insert_with(|| {
+            let screens = Screens {
+                acts: Rc::new(RefCell::new(Vec::new())),
+                dots: Anchored::new(),
+                tapped: Rc::new(RefCell::new(None)),
+                card: None,
+            };
+            // Mounted once and kept: an empty list draws nothing.
+            crate::systems::lib_host::mount_keyed(
+                MARKS,
+                dots_view(&screens.dots, &screens.tapped),
+                theme::p().ink == theme::DARK.ink,
+                theme::touch_layout(),
+            );
+            screens
+        });
+        if let Some(key) = screens.tapped.borrow_mut().take() {
+            feeds.lib_tapped = Some(key);
+        }
+        screens.dots.sync(feeds.marks.iter().map(|d| {
+            (
+                d.key.clone(),
+                Spot::at(d.at.x * k, d.at.y * k),
+                DotStyle {
+                    title: d.title.clone(),
+                    colour: d.colour,
+                },
+            )
+        }));
+        let acts: Vec<Act> = std::mem::take(&mut *screens.acts.borrow_mut());
+        for a in acts {
+            match a {
+                Act::Close => feeds.card = None,
+                Act::Url(url) => crate::systems::data_layers::open_url(&url),
+            }
+        }
+        let want = feeds.card.clone().map(|card| CardState {
+            place: Placement::over_the_dock(size.x, size.y, ui_scale),
+            card,
+        });
+        match (want, screens.card.as_ref()) {
+            (None, None) => {}
+            (None, Some(_)) => {
+                screens.card = None;
+                crate::systems::lib_host::clear_keyed(CARD);
+            }
+            (Some(v), None) => {
+                let s = signal(v);
+                let p = theme::p();
+                crate::systems::lib_host::mount_keyed(
+                    CARD,
+                    card_view(s.clone(), &screens.acts),
+                    p.ink == theme::DARK.ink,
+                    theme::touch_layout(),
+                );
+                screens.card = Some(s);
+            }
+            (Some(v), Some(s)) => {
+                if s.peek(|now| *now != v) {
+                    s.set(v);
+                }
+            }
+        }
+    });
+}
+
+fn dots_view(dots: &Anchored<DotStyle>, tapped: &Rc<RefCell<Option<String>>>) -> View {
+    let tapped = tapped.clone();
+    dots.view(MARKS_Z, move |key, s| dot_view(key, s, &tapped))
+}
+
+/// A dot about its record's place: the square it answers taps in, and the
+/// bordered disc in its middle.
+fn dot_view(key: &str, d: &DotStyle, tapped: &Rc<RefCell<Option<String>>>) -> View {
+    let tap: Handler = {
+        let (tapped, key) = (tapped.clone(), key.to_string());
+        Rc::new(move |_: &Event| *tapped.borrow_mut() = Some(key.clone()))
+    };
+    let side = 2.0 * DOT_R + 12.0;
+    let o = DOT_R + RIM / 2.0;
+    let disc = boxed(
+        side / 2.0 - o,
+        side / 2.0 - o,
+        2.0 * o,
+        2.0 * o,
+        &format!(
+            "box-sizing: border-box; border-radius: {o:.1}px; background: {}; border: {RIM:.1}px solid {}",
+            css(d.colour),
+            css(theme::DARK.ink)
+        ),
+    );
+    let frame = boxed(-side / 2.0, -side / 2.0, side, side, "cursor: pointer");
+    let title = d.title.clone();
+    view! {
+        <div style={frame} title={title} on:click={move |e: &Event| tap(e)}><div style={disc}></div></div>
+    }
+}
+
+/// The record's card: the layer and its colour, the title, the fields, where
+/// it is from, and its own address.
+fn card_view(s: Signal<CardState>, acts: &Rc<RefCell<Vec<Act>>>) -> View {
+    let frame = {
+        let s = s.clone();
+        move || s.get().place.style()
+    };
+    let kicker = {
+        let s = s.clone();
+        move || -> View {
+            let c = s.get().card;
+            let dot = format!(
+                "flex: none; width: 10px; height: 10px; border-radius: var(--m-radius-full); background: {}",
+                css(colour(c.record.3))
+            );
+            let name = c.feed.name.clone();
+            let value: View = match value_label(&c) {
+                Some(v) => view! { <span style="color: var(--m-text-dim); font-weight: 400; text-transform: none; letter-spacing: 0">{format!("· {v}")}</span> },
+                None => View::Empty,
+            };
+            view! {
+                <span style="flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--m-text-strong); font-size: var(--m-font-size-sm); font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase">
+                    <span style={dot}></span>{name}{value}
+                </span>
+            }
+        }
+    };
+    let body = {
+        let s = s.clone();
+        let acts = acts.clone();
+        move || -> View {
+            let c = s.get().card;
+            let title = c.record.2.clone();
+            let rows: Vec<View> = card_rows(&c)
+                .into_iter()
+                .map(|(k, v)| {
+                    view! {
+                        <div style="display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: var(--m-font-size-sm); line-height: 1.45">
+                            <span style="color: var(--m-text-dim)">{k}</span>
+                            <span style="color: var(--m-text-strong); overflow-wrap: anywhere">{v}</span>
+                        </div>
+                    }
+                })
+                .collect();
+            let source = source_line(&c.feed);
+            let link = c.record.5.clone();
+            let record: View = if link.starts_with("https://") || link.starts_with("http://") {
+                if crate::systems::data_layers::open_url_supported() {
+                    let click = on(&acts, Act::Url(link));
+                    view! { <Button variant=Variant::Secondary icon={icon(icons::OPEN_EXTERNAL)} onclick={Some(click)}>"Record"</Button> }
+                } else {
+                    view! { <ListItem icon={icon(icons::OPEN_EXTERNAL)} href={Some(link)}>"Record"</ListItem> }
+                }
+            } else {
+                View::Empty
+            };
+            view! {
+                <p style="margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--m-text-strong)">{title}</p>
+                {rows}
+                <div style="display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; padding: 8px 10px; border-radius: var(--m-radius-md); background: var(--m-surface-raised); color: var(--m-text-dim); font-size: 12px; line-height: 1.45">
+                    <span style="flex: none">{icon(icons::RECORD)}</span>
+                    <span>{source}</span>
+                </div>
+                <div style="display: flex; gap: 8px; margin-top: 4px">{record}</div>
+            }
+        }
+    };
+    let close = on(acts, Act::Close);
+    // The card's own node listens, so the pointer over its padding is the
+    // library's too (`UiPointer` counts only nodes that listen).
+    view! {
+        <div style={frame} on:click={|_: &Event| {}}>
+            <div style="flex: none; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 4px 12px 0 16px">
+                {kicker}
+                <CloseButton onclick={Some(close)} />
+            </div>
+            <div style="min-height: 0; overflow-y: auto; padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 8px">
+                {body}
+            </div>
+        </div>
+    }
+}
diff --git a/crates/cartopolis/src/systems/gui/lib_layers.rs b/crates/cartopolis/src/systems/gui/lib_layers.rs
index 75c96d64..796bcca6 100644
--- a/crates/cartopolis/src/systems/gui/lib_layers.rs
+++ b/crates/cartopolis/src/systems/gui/lib_layers.rs
@@ -12,6 +12,7 @@
 //! resource assigned only when something differs.
 
 use std::cell::{Cell, RefCell};
+use std::collections::BTreeMap;
 use std::rc::Rc;
 
 use bevy::ecs::system::NonSendMarker;
@@ -22,6 +23,7 @@ use mithril::prelude::{Button, Event};
 
 use crate::resources::{GlobeCloudMode, RightPanel};
 use crate::systems::data_layers::{DataLayers, LAYER_DEFS};
+use crate::systems::feeds::Feeds;
 use crate::systems::layer_state::LayerCategory;
 use crate::systems::layers_panel::PLANS_TILE;
 use crate::systems::lib_settings::LibScreens;
@@ -83,6 +85,10 @@ struct Live {
     satellites_enabled: Signal<bool>,
     satellite_kinds: Vec<Signal<bool>>,
     scenario_label: Signal<Option<String>>,
+    /// Layers ▸ Data: the published layers, as last read (`systems::feeds`).
+    feeds: Signal<DataTab>,
+    /// One switch per data layer, made when its tile first draws.
+    feed_on: Rc<RefCell<BTreeMap<String, Signal<bool>>>>,
     close: Rc<Cell<bool>>,
     reset: Rc<Cell<bool>>,
     to_about: Rc<Cell<bool>>,
@@ -133,6 +139,10 @@ impl Live {
             satellites_enabled: sig(dl.satellites_enabled),
             satellite_kinds: dl.satellite_kinds.iter().map(|v| sig(*v)).collect(),
             scenario_label: signal(scenario_label(dl)),
+            feeds: signal(DataTab::default()),
+            feed_on: Rc::new(RefCell::new(
+                dl.feeds.iter().map(|(id, on)| (id.clone(), signal(*on))).collect(),
+            )),
             close: Rc::new(Cell::new(false)),
             reset: Rc::new(Cell::new(false)),
             to_about: Rc::new(Cell::new(false)),
@@ -249,8 +259,59 @@ fn scenario_label(dl: &DataLayers) -> Option<String> {
     })
 }
 
+/// Layers ▸ Data as the panel draws it: the published layers, or why there
+/// are none.
+#[derive(Clone, Debug, Default, PartialEq)]
+struct DataTab {
+    tiles: Vec<FeedTile>,
+    loading: bool,
+    failed: bool,
+}
+
+/// One data layer's tile.
+#[derive(Clone, Debug, PartialEq)]
+struct FeedTile {
+    id: String,
+    name: String,
+    group: String,
+    /// "via TripleXL · CC BY 4.0".
+    route: String,
+    credit: String,
+    records: u64,
+    key: Vec<(String, theme::Rgba8)>,
+}
+
+impl DataTab {
+    fn of(feeds: &Feeds) -> Self {
+        DataTab {
+            tiles: feeds
+                .list()
+                .iter()
+                .map(|f| FeedTile {
+                    id: f.id.clone(),
+                    name: f.name.clone(),
+                    group: f.group.clone(),
+                    route: [
+                        (!f.via.is_empty()).then(|| format!("via {}", f.via)),
+                        (!f.licence.is_empty()).then(|| f.licence.clone()),
+                    ]
+                    .into_iter()
+                    .flatten()
+                    .collect::<Vec<_>>()
+                    .join(" · "),
+                    credit: f.credit.clone(),
+                    records: f.records,
+                    key: crate::systems::feeds::key(f),
+                })
+                .collect(),
+            loading: feeds.loading(),
+            failed: feeds.failed(),
+        }
+    }
+}
+
 /// What is on per category, for the badges (`layers_panel::category_counts`).
-fn counts(dl: &DataLayers) -> [u64; 6] {
+fn counts(dl: &DataLayers) -> [u64; 7] {
     let n = |xs: &[bool]| xs.iter().filter(|x| **x).count() as u64;
     let places: Vec<bool> = dl
         .layers
@@ -291,6 +352,7 @@ fn counts(dl: &DataLayers) -> [u64; 6] {
         ]),
         n(&under),
         n(&[dl.satellites_enabled]),
+        dl.feeds.values().filter(|on| **on).count() as u64,
     ]
 }
 
@@ -298,7 +360,7 @@ fn counts(dl: &DataLayers) -> [u64; 6] {
 /// signal the strip reads.
 struct Mounted {
     l: Live,
-    counts: Signal<[u64; 6]>,
+    counts: Signal<[u64; 7]>,
     last_bools: Vec<bool>,
     last_layers: Vec<bool>,
     last_plans_kinds: Vec<bool>,
@@ -308,6 +370,7 @@ struct Mounted {
     last_open_tile: Option<&'static str>,
     last_clouds: GlobeCloudMode,
     last_period: Period,
+    last_feeds: BTreeMap<String, bool>,
 }
 
 impl Mounted {
@@ -325,14 +388,34 @@ impl Mounted {
             last_open_tile: dl.open_tile,
             last_clouds: dl.globe_clouds,
             last_period: dl.plans_period,
+            last_feeds: dl.feeds.clone(),
             l,
         }
     }
 
     /// Signals that moved write the resource; fields that moved write the
     /// signals. Answers whether the resource changed.
-    fn sync(&mut self, dl: &mut DataLayers) -> bool {
+    fn sync(&mut self, dl: &mut DataLayers, feeds: &Feeds) -> bool {
         let mut changed = false;
+        // The data layers' switches, made as their tiles draw: a switch moved
+        // writes the resource, a resource moved (the MCP, a restore) the switch.
+        for (id, sig) in self.l.feed_on.borrow().iter() {
+            let s = sig.get();
+            let last = self.last_feeds.get(id).copied().unwrap_or(false);
+            let field = dl.feeds.get(id).copied().unwrap_or(false);
+            if s != last {
+                dl.feeds.insert(id.clone(), s);
+                self.last_feeds.insert(id.clone(), s);
+                changed = true;
+            } else if field != last {
+                sig.set(field);
+                self.last_feeds.insert(id.clone(), field);
+            }
+        }
+        let tab = DataTab::of(feeds);
+        if self.l.feeds.peek(|now| *now != tab) {
+            self.l.feeds.set(tab);
+        }
         macro_rules! one {
             ($sig:expr, $field:expr, $last:expr) => {{
                 let s = $sig.get();
@@ -434,6 +517,7 @@ pub fn drive_lib_layers(
     mut dl: ResMut<DataLayers>,
     metrics: Res<UiMetrics>,
     layer_view: crate::systems::layers_panel::LayerView,
+    feeds: Res<Feeds>,
     mut opened: Local<bool>,
 ) {
     if !lib.layers {
@@ -467,6 +551,7 @@ pub fn drive_lib_layers(
                     }
                 }
                 let mounted = Mounted::new(dl.bypass_change_detection(), in_space, tdbag_available);
+                mounted.l.feeds.set(DataTab::of(&feeds));
                 let compact = metrics.compact();
                 let p = theme::p();
                 crate::systems::lib_host::mount_keyed(
@@ -491,7 +576,7 @@ pub fn drive_lib_layers(
                 // when something differs: `DataLayers::is_changed` restarts
                 // streaming work.
                 let inner = dl.bypass_change_detection();
-                let changed = mounted.sync(inner);
+                let changed = mounted.sync(inner, &feeds);
                 if changed {
                     dl.set_changed();
                 }
@@ -554,11 +639,12 @@ fn reset(dl: &mut DataLayers) {
     dl.plans_council = fresh.plans_council;
     dl.plans_works = fresh.plans_works;
     dl.plans_period = fresh.plans_period;
+    dl.feeds = fresh.feeds;
 }
 
 /// The panel's HTML from the library's string renderer, for the browser
 /// beside the capture.
-fn html(l: &Live, counts: &Signal<[u64; 6]>, compact: bool) -> String {
+fn html(l: &Live, counts: &Signal<[u64; 7]>, compact: bool) -> String {
     use mithril::view::{mount, StringRenderer};
     let r = Rc::new(RefCell::new(StringRenderer::new()));
     let root = r.borrow().root();
@@ -639,7 +725,7 @@ fn options_box(title: &'static str, body: View) -> View {
 
 /// The panel: a header with Reset and ✕, the category strip, the category's
 /// body, the credits.
-fn panel(l: &Live, counts: &Signal<[u64; 6]>, compact: bool) -> View {
+fn panel(l: &Live, counts: &Signal<[u64; 7]>, compact: bool) -> View {
     let frame = if compact {
         "position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; flex-direction: column; background: var(--m-bg)"
     } else {
@@ -679,6 +765,7 @@ fn panel(l: &Live, counts: &Signal<[u64; 6]>, compact: bool) -> View {
                 LayerCategory::Moving => moving(&l),
                 LayerCategory::Under => under(&l),
                 LayerCategory::Orbit => orbit(&l),
+                LayerCategory::Data => data(&l),
             }
         }
     };
@@ -916,6 +1003,92 @@ fn places(l: &Live) -> View {
     }
 }
 
+/// Layers ▸ Data: a tile per published layer under its publisher, with the
+/// route and licence under each name and, while a layer is on, its key.
+fn data(l: &Live) -> View {
+    let tab = l.feeds.get();
+    if tab.tiles.is_empty() {
+        let why = if tab.loading {
+            "Reading the data layers…"
+        } else if tab.failed {
+            "Could not reach the data layers. They come back when the map's data host does."
+        } else {
+            "No data layers are published on this server yet. An operator adds them on the Admin page."
+        };
+        return note(why);
+    }
+    let low = l.in_space.get().then_some(NEAR_GROUND);
+    let mut groups: Vec<(String, Vec<FeedTile>)> = Vec::new();
+    for t in tab.tiles {
+        match groups.last_mut() {
+            Some((g, tiles)) if *g == t.group => tiles.push(t),
+            _ => groups.push((t.group.clone(), vec![t])),
+        }
+    }
+    let views: Vec<View> = groups
+        .into_iter()
+        .map(|(name, tiles)| {
+            let route = tiles.first().map(|t| t.route.clone()).unwrap_or_default();
+            let mut keys: Vec<View> = Vec::new();
+            let grid: Vec<View> = tiles
+                .iter()
+                .map(|t| {
+                    let sig = l
+                        .feed_on
+                        .borrow_mut()
+                        .entry(t.id.clone())
+                        .or_insert_with(|| signal(false))
+                        .clone();
+                    if sig.get() && !t.key.is_empty() {
+                        keys.push(feed_key(t));
+                    }
+                    let hint = low.map(str::to_owned);
+                    let label = t.name.clone();
+                    // How many records it holds, in the tag after its name.
+                    let badge: View = t.records.to_string().into_view();
+                    view! {
+                        <Tile model={sig} icon={icon(icons::RECORD)} badge={badge} hint={hint} more={None} open={false}>{label}</Tile>
+                    }
+                })
+                .collect();
+            let credit = tiles.first().map(|t| t.credit.clone()).unwrap_or_default();
+            let title = name.clone();
+            view! {
+                <p style="margin: 12px 0 0; color: var(--m-text-dim); font-size: var(--m-font-size-sm); font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase">{title}</p>
+                {small(format!("{credit} · {route}"))}
+                <TileGrid>{grid}</TileGrid>
+                {keys}
+            }
+        })
+        .collect();
+    view! { {views} }
+}
+
+/// A data layer's key under its group: each value's dot and name.
+fn feed_key(t: &FeedTile) -> View {
+    let rows: Vec<View> = t
+        .key
+        .iter()
+        .map(|(label, c)| {
+            let dot = format!(
+                "display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: {}",
+                css(*c)
+            );
+            let label = label.clone();
+            view! {
+                <span style="display: inline-flex; align-items: center; gap: 6px; font-size: var(--m-font-size-sm)"><span style={dot}></span>{label}</span>
+            }
+        })
+        .collect();
+    let title = t.name.clone();
+    view! {
+        <div style="display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--m-surface-raised); border: 1px solid var(--m-border); border-radius: var(--m-radius-lg)">
+            <p style="margin: 0; font-size: var(--m-font-size-sm); font-weight: 600; color: var(--m-text-strong)">{title}</p>
+            <div style="display: flex; flex-wrap: wrap; column-gap: 12px; row-gap: 4px">{rows}</div>
+        </div>
+    }
+}
+
 fn moving(l: &Live) -> View {
     let low = l.in_space.get().then_some(NEAR_GROUND);
     view! {
diff --git a/crates/cartopolis/src/systems/gui/mod.rs b/crates/cartopolis/src/systems/gui/mod.rs
index 32fa124d..132ed5c3 100644
--- a/crates/cartopolis/src/systems/gui/mod.rs
+++ b/crates/cartopolis/src/systems/gui/mod.rs
@@ -123,6 +123,8 @@ pub mod lib_places;
 #[cfg(feature = "ui-lib")]
 pub mod lib_plans;
 #[cfg(feature = "ui-lib")]
+pub mod lib_feeds;
+#[cfg(feature = "ui-lib")]
 pub mod lib_poi_card;
 #[cfg(all(feature = "ui-lib", not(target_arch = "wasm32")))]
 pub mod lib_release_approval;
@@ -181,6 +183,7 @@ pub mod place_card;
 pub mod place_names;
 pub mod place_pins;
 pub mod plans;
+pub mod feeds;
 pub mod scenario;
 pub mod script_editor;
 pub mod settings;
diff --git a/crates/cartopolis/src/systems/gui/plugin.rs b/crates/cartopolis/src/systems/gui/plugin.rs
index bfcc8828..253a6942 100644
--- a/crates/cartopolis/src/systems/gui/plugin.rs
+++ b/crates/cartopolis/src/systems/gui/plugin.rs
@@ -81,6 +81,11 @@ impl Plugin for GuiPlugin {
                     systems::lib_marquee::drive_lib_marquee,
                 ),
             )
+            // Layers ▸ Data's dots and card, under the plans' marks.
+            .add_systems(
+                PostUpdate,
+                systems::lib_feeds::drive_lib_feeds.after(systems::lib_plans::drive_lib_plans),
+            )
             // A chat's picture or a place's photo, full size; after Places, so
             // a photo opens in the frame of its tap (as `ui_probe` has it).
             .add_systems(
@@ -114,6 +119,7 @@ impl Plugin for GuiPlugin {
             .init_resource::<systems::welcome::Welcome>()
             // Layers ▸ Places ▸ Plans, and the card a dot opens (`systems::plans`).
             .init_resource::<systems::plans::Plans>()
+            .init_resource::<systems::feeds::Feeds>()
             .init_resource::<systems::onscreen_keyboard::OnScreenKeyboard>()
             // What the on-screen navigation controls asked for this frame
             // (`systems::map_osd`); read by `free_camera::camera_controls`.
@@ -229,6 +235,14 @@ impl Plugin for GuiPlugin {
             ),
         );
 
+        // Layers ▸ Data (`systems::feeds`): the index, the manifests and the
+        // cells round the stream centre; the dots are placed with the plans'
+        // below.
+        app.add_systems(
+            Update,
+            systems::feeds::drive_feeds.in_set(ClientPhase::Stream),
+        );
+
         // The design room (`systems::design_room`): the ring's Design here is
         // taken after the ring draws; the room's layers are set before the
         // frame renders; its bar is a floating `Foreground` area, like the
@@ -643,6 +657,7 @@ impl Plugin for GuiPlugin {
             (
                 systems::scenario::place_scenario_map,
                 systems::place_names::lay_out_place_names,
+                systems::feeds::place_feeds,
                 systems::plans::place_plans,
                 // And after the people it stands markers on have moved
                 // (`place_chat_bubbles` says why).
diff --git a/crates/cartopolis/src/systems/map/layer_state.rs b/crates/cartopolis/src/systems/map/layer_state.rs
index 2c5c7c0f..ccdf69c7 100644
--- a/crates/cartopolis/src/systems/map/layer_state.rs
+++ b/crates/cartopolis/src/systems/map/layer_state.rs
@@ -256,6 +256,10 @@ pub struct DataLayers {
     pub plans_works: bool,
     /// How far back the layer looks.
     pub plans_period: Period,
+    /// Layers ▸ Data (`systems::feeds`): which of atlas's data layers are
+    /// on, by id. A layer missing here is off; one no longer published is
+    /// kept, so it comes back on if it is published again.
+    pub feeds: std::collections::BTreeMap<String, bool>,
     /// The Layers panel's open category. View state, not a preference.
     pub category: LayerCategory,
     /// The tile whose ⋯ options are showing under the grid, by its label.
@@ -371,7 +375,7 @@ pub enum Period {
     Year,
 }
 
-/// The six places a layer can be: what the panel groups by.
+/// The seven places a layer can be: what the panel groups by.
 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
 pub enum LayerCategory {
     #[default]
@@ -381,4 +385,6 @@ pub enum LayerCategory {
     Moving,
     Under,
     Orbit,
+    /// Records from sources outside Cartopolis (`systems::feeds`).
+    Data,
 }
diff --git a/crates/cartopolis/src/systems/mod.rs b/crates/cartopolis/src/systems/mod.rs
index 2d6760dc..18016b65 100644
--- a/crates/cartopolis/src/systems/mod.rs
+++ b/crates/cartopolis/src/systems/mod.rs
@@ -60,7 +60,8 @@ pub use cartopolis_geo::{
 };
 pub use gui::{
     action_ring, app_update, avatar_designer, bookmarks, building_card, chat, cosmos, data_layers,
-    design_room, discs, dismiss, dock, facade_check, faces, floor_picker, hud, icons, layer_tiles,
+    design_room, discs, dismiss, dock, facade_check, faces, feeds, floor_picker, hud, icons,
+    layer_tiles,
     map_osd, model_library, motion, onscreen_keyboard, place_card, place_names, place_pins, plans,
     scenario, script_editor, settings, splash, theme, ui, ui_input, ui_theme, welcome, zoom_rail,
 };
@@ -83,7 +84,8 @@ pub use gui::{
 #[cfg(feature = "ui-lib")]
 pub use gui::{
     lib_action_ring, lib_app_update, lib_avatar, lib_chrome, lib_cosmos, lib_design_room,
-    lib_driver, lib_face_viewfinder, lib_interact, lib_locate, lib_main_menu, lib_map_osd,
+    lib_driver, lib_face_viewfinder, lib_feeds, lib_interact, lib_locate, lib_main_menu,
+    lib_map_osd,
     lib_models, lib_pins, lib_place_names, lib_plans, lib_poi_card, lib_satellite_menu,
     lib_scenario, lib_scenario_map, lib_script, lib_splash, lib_walk_guide,
 };
diff --git a/crates/cartopolis/src/systems/net/user_store.rs b/crates/cartopolis/src/systems/net/user_store.rs
index 740452dc..09dd79d7 100644
--- a/crates/cartopolis/src/systems/net/user_store.rs
+++ b/crates/cartopolis/src/systems/net/user_store.rs
@@ -392,6 +392,9 @@ pub struct LayerPrefs {
     /// default.
     #[serde(default)]
     pub plans_period: String,
+    /// Layers ▸ Data (`systems::feeds`): which data layers are on, by id.
+    #[serde(default)]
+    pub feeds: std::collections::HashMap<String, bool>,
     #[serde(default)]
     pub overlays: std::collections::HashMap<String, bool>,
 }
diff --git a/docs/notes/data-layers.md b/docs/notes/data-layers.md
new file mode 100644
index 00000000..2da1c3f1
--- /dev/null
+++ b/docs/notes/data-layers.md
@@ -0,0 +1,62 @@
+---
+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), stage 1: points from
+TripleXL's saved queries, Layers ▸ Data, the dot and its card. 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:
+  `<http://www.opengis.net/def/crs/EPSG/0/28992> 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`). **Stage 1 polls** on the layer's
+  clock (6 h by default, a tenth of that after a failure); following the feed
+  is the next stage.
+
+## Not built yet
+
+Following the change feed; lines and areas (the WKT parser places points only,
+and counts the rest as unplaced); the Admin page (layers are kept through
+`/api/pipeline/feeds` for now); queries that ask for a value; private datasets.