How asfadmin/archive_heatmaps works
Purpose and Delivery
Archive Heatmap is a browser-hosted, interactive visualization client for Sentinel-1 archive coverage. Users choose date ranges, product types, and platforms; the client retrieves matching archive data and renders a GPU-backed geographic heatmap. The HTML/Wasm entry point is index.html, with application bootstrap in src/main.rs; Trunk builds and serves the Rust-to-WebAssembly application (Trunk.toml).
Application Composition
The codebase is organized around three architectural subsystems:
• Canvas/GPU rendering: src/canvas/mod.rs, src/canvas/app.rs, src/canvas/pipeline.rs
• Archive querying and geometry preparation: src/ingest/mod.rs, src/ingest/load.rs, src/ingest/mesh.rs
• Overlay UI and query controls: src/ui/mod.rs, src/ui/user_interface.rs, src/ui/legend.rs
Shared domain/state types live in src/types.rs.
UI and Interaction Boundary
The UI is overlaid on the rendered heatmap and supplies the archive-selection inputs and user feedback. src/ui/user_interface.rs coordinates controls, while src/ui/popup.rs and src/ui/feedback.rs support transient interaction/status surfaces. UI submission is the primary boundary into ingest: it turns selected filters into a request rather than directly manipulating GPU resources.
Ingest and Query Pipeline
The ingest layer queries public archive data through browser DuckDB integration. src/ingest/request.rs represents query/request concerns, src/ingest/sql.rs defines SQL-facing logic, and src/ingest/async_duckdb.rs manages asynchronous DuckDB execution. The browser-side DuckDB asset is assets/duckdb-browser.mjs, with supporting glue in src/ingest/duckdb.js.
Query results are loaded and transformed into renderable geographic mesh data by src/ingest/load.rs and src/ingest/mesh.rs. This is the key data boundary: archive/query-oriented records become GPU-friendly geometry.
Canvas State, Camera, and Input
src/canvas/app.rs orchestrates the visualization lifecycle. Persistent rendering/application state is held in src/canvas/state.rs; navigation/view transformation is separated into src/canvas/camera.rs; browser interaction is translated by src/canvas/input.rs. This keeps user gestures and UI actions distinct from mesh generation and low-level rendering.
GPU Rendering and Export
wgpu/Wasm rendering infrastructure is centered on src/canvas/render_context.rs, src/canvas/pipeline.rs, and src/canvas/texture.rs. Geometry enters through src/canvas/geometry.rs, then shader pipelines generate and composite heatmap layers. WGSL programs include blending, colormapping, outlines, and export paths under src/canvas/shaders/.
The renderer also supports image output via src/canvas/png.rs and export shaders such as src/canvas/shaders/export.wgsl. Colormap/static visual assets are supplied from assets.
Runtime and External Dependencies
The production runtime is a static web client compiled from Rust to wasm32-unknown-unknown, built/served with Trunk. It requires nightly Rust per rust-toolchain.toml. Browser GPU access is provided through wgpu-compatible WebGPU/Wasm execution. DuckDB runs in the browser and accesses archive data from a public S3 bucket; Sentinel-1 data is attributed to the Alaska Satellite Facility. GitHub Pages deployment is defined in .github/workflows/gh-pages-deploy.yml.
Main entry points: main.rs Application bootstrap · async_duckdb.rs Browser DuckDB · app.rs Visualization lifecycle · pipeline.rs Heatmap renderer
Components 17
Web Delivery
- Browser entry point
index.html - Application bootstrap
src/main.rs - Trunk build and serve
Trunk.toml - GitHub Pages deployment
.github/workflows/gh-pages-deploy.yml
Overlay UI
- Query controls · Collects archive filters and shows interaction feedback.
src/ui/user_interface.rs - Legend and transient UI
src/ui/legend.rs
Archive Ingest
- Archive request
src/ingest/request.rs - Browser DuckDB · Executes SQL in the browser.
src/ingest/async_duckdb.rs - DuckDB browser asset
assets/duckdb-browser.mjs - Public Sentinel-1 archive
- Geographic mesh preparation · Converts query results into GPU-friendly geographic geometry.
src/ingest/mesh.rs
Canvas and GPU
- Visualization lifecycle
src/canvas/app.rs - View state and input · Maintains render state, camera transforms, and browser gesture translation.
src/canvas/state.rs - GPU geometry
src/canvas/geometry.rs - Heatmap renderer · Builds and composites GPU heatmap layers.
src/canvas/pipeline.rs - Image export
src/canvas/png.rs
Other components
- WebGPU/Wasm runtime
Connections 19
- Trunk build and serve → Browser entry point: builds and serves
- Trunk build and serve → Application bootstrap: compiles to Wasm
- Browser entry point → Application bootstrap: loads
- Application bootstrap → Visualization lifecycle: starts
- Application bootstrap → Query controls: mounts
- Query controls → Legend and transient UI: updates
- Query controls → Archive request: submits filters
- Archive request → Browser DuckDB: drives query
- DuckDB browser asset → Browser DuckDB: provides browser engine
- Browser DuckDB → Public Sentinel-1 archive: queries
- Browser DuckDB → Geographic mesh preparation: returns records
- Geographic mesh preparation → GPU geometry: produces
- Visualization lifecycle → View state and input: coordinates
- View state and input → Visualization lifecycle: navigation and gestures
- GPU geometry → Heatmap renderer: uploads
- Visualization lifecycle → Heatmap renderer: renders with state
- Heatmap renderer → WebGPU/Wasm runtime: uses
- Heatmap renderer → Image export: exports image
- GitHub Pages deployment → Browser entry point: publishes static client