Tauri backend
The desktop shell is in apps/desktop/src-tauri/. src/lib.rs registers three plugins and five commands:
tauri::Builder::default() .plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_fs::init()) .plugin(tauri_plugin_store::Builder::new().build()) .setup(|app| { let _store = app.store("config.json")?; Ok(()) }) .invoke_handler(tauri::generate_handler![ commands::import::import_file, commands::export::export_screenshot, commands::fs_cache::read_tile_cache, commands::fs_cache::write_tile_cache, commands::fs_cache::missing_tile_cache, commands::fs_cache::clear_tile_cache, commands::sample::sample_layers, ])Dependencies are deliberately small: tauri 2, the dialog, fs and store plugins, serde /
serde_json, base64, and tiff 0.9. There is no GDAL.
Window and build
Section titled “Window and build”From tauri.conf.json:
- Product: “NISAR Surface Change Monitor”, identifier
com.nisar.surface-change-monitor. - Window: 1400 × 900 by default, minimum 900 × 600.
- Dev: runs
pnpm --filter web devand loadshttp://localhost:5173. - Build: runs
pnpm --filter web buildand bundles../../web/dist(that is,apps/web/dist) for all targets.
sample_layers
Section titled “sample_layers”#[tauri::command]async fn sample_layers( app: AppHandle, lng: f64, lat: f64, period: String, layer_ids: Option<Vec<String>>,) -> Result<Vec<LayerSample>, String>The frontend calls it on every map click (selectionStore.inspectCoordinate). It works as
follows:
- Find the workspace. It walks up from the current directory (
apps/desktop/src-tauriundertauri dev) until it findsapps/web/public/data/manifest.json, then falls back to the resource directory. - Read the manifest and group entries by layer id, keeping only
layer_idswhen given. - Project WGS84 to UTM zone 51N (EPSG:32651, central meridian 123 °E) with a
closed-form transverse Mercator in
wgs84_to_utm51n(). No projection crate is needed. - Pick the period per layer: an exact match, else the latest period at or before the request, else the first.
- Read the pixel from
data/<sourceFile>with thetiffcrate. The geotransform comes from the GeoTIFF tagsModelPixelScale(33550) andModelTiepoint(33922), not from assumptions. Int16, UInt8, UInt16, Int32, UInt32, Float32 and Float64 are supported. - Interpret the value. NaN or
nodatareturnsvalue: null. Otherwise the raw value is multiplied byscaleFactor, and categorical codes are mapped toclassName/classColor.
LayerSample (camelCase JSON)
Section titled “LayerSample (camelCase JSON)”{ layerId: string; family: string; name: string; period: string; value: number | null; raw: number | null; className?: string | null; classColor?: string | null; units: string; caveats: string[];}If data/ is missing, every sample has value: null. If the command itself fails, the
frontend falls back to placeholder readings.
Other commands
Section titled “Other commands”| Command | Signature | Behaviour |
|---|---|---|
import_file |
() -> ImportedFile { name, path, size } |
Opens a file picker filtered to GeoTIFF and GeoJSON, and returns metadata. Not yet used by the UI. |
export_screenshot |
(data_url: String) -> String |
Saves a data:image/png;base64,… URL through a save dialog and returns the path. Not yet used by the UI. |
read_tile_cache |
(key: String) -> Response (raw bytes) |
Reads <app cache dir>/tiles/<key>. An empty body means not cached. |
write_tile_cache |
raw body, x-tile-key header |
Writes <app cache dir>/tiles/<key> through a .part file. |
missing_tile_cache |
(entries: Vec<(String, u64)>) -> Vec<String> |
Keys that are not cached or whose cached size differs. |
clear_tile_cache |
() |
Deletes <app cache dir>/tiles/. |
Store plugin
Section titled “Store plugin”The app’s store holds the persisted panel open/closed state (uiStore) and bookmarks
(bookmarkStore).
