Skip to content

explorer: point-mode counts use padded fetch box, not visible viewport #211

@rdhyee

Description

@rdhyee

Follow-up suggested by Codex on PR #210 (which closes #206 by surfacing the real point-mode count when capped).

Current state after #210

Point-mode "Samples in View" displays the real count from a count(*) query against the padded fetch box (30% larger than the visible viewport, explorer.qmd:1517-1522), not the actually-visible bounds. The cap is no longer silent — users see e.g. "23,422 samples in view (showing 5,000 — zoom in for more)" — but "in view" still loosely means "in the padded cache window" rather than "in the visible Cesium camera frustum."

The same loose meaning was true before #210; the fix didn't tighten it, just stopped the under-reporting.

Why this matters

A small pan inside the cached padded window currently:

In dense regions where the padded box is much larger than the visible viewport (e.g., Cyprus at alt=15212), this overstates the visible count by whatever fraction of the padded box is off-screen.

Proposed fix

When point-mode samples are loaded:

  • Keep the padded fetch + cache (good for smooth panning).
  • But compute "Samples in View" against the visible bounds, not padded.
  • On cache-hit pans, recompute the visible-bounds intersection cheaply on the cached array (no DuckDB round-trip required for the rendered count; the total can be re-queried or estimated).

Possible structure:

  • cachedTotalCount (post-explorer: report real Samples-in-View count when cap is reached (closes #206) #210) becomes "total samples in padded fetch box, capped at POINT_BUDGET-renders" — internal.
  • New inViewCount(bounds) filters cachedData by visible bounds for the rendered tally.
  • When capped, the displayed "Samples in View" should be the visible-bounds count, not the padded-box count. May require a small additional count query keyed on the visible bounds.

Acceptance

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions