From 6fbaf5d8c86ffe8509222f50983f5ad7d143a4d2 Mon Sep 17 00:00:00 2001 From: elpidioassinaturas Date: Mon, 23 Nov 2026 23:44:25 -0300 Subject: [PATCH 1/3] feat(extensions): clip, resample and mosaic run without the Imagery extension (#2823) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit raster.process and raster.mosaic leave the Imagery extension's list, as raster.project and raster.rasterize already are, and are under Analyze › Raster. The Process button moves from Imagery › Imagery Tools to that group. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/imagery.rs | 4 +- crates/engine/src/extensions.rs | 20 +++++++-- crates/engine/src/tests.rs | 67 ++++++++++++++++++++++++++++++ crates/ui-egui/src/analysispane.rs | 4 +- crates/ui-egui/src/chrome.rs | 15 +++++++ crates/ui-egui/src/extensionsui.rs | 10 +++++ crates/ui-egui/src/ribbon.rs | 13 +++++- crates/ui-egui/tests/smoke.rs | 32 ++++++++++++++ docs/user-guide/analysis.md | 21 ++++++---- docs/user-guide/index.md | 4 +- 10 files changed, 172 insertions(+), 18 deletions(-) diff --git a/crates/engine/src/cmd/imagery.rs b/crates/engine/src/cmd/imagery.rs index 27ce619cfd..59fad020fd 100644 --- a/crates/engine/src/cmd/imagery.rs +++ b/crates/engine/src/cmd/imagery.rs @@ -73,9 +73,9 @@ pub fn commands() -> Vec { C::new("raster.index", "Indices", "Imagery › Imagery Tools", index).inputs(raster_inputs).roles(&[]).effects(crate::policy::Effects::NONE).params( r#"{"layer": raster, "index": "ndvi"|"ndwi"|"savi"|"nbr"|"ndbi"|"evi", "red"?, "green"?, "blue"?, "nir"?, "swir"?: band numbers, "name"?: output, "ran"?: (internal: a raster the app has worked out)}"#, ), - C::new("raster.process", "Process", "Imagery › Imagery Tools", process).inputs(process_inputs).roles(&[]).effects(crate::policy::Effects::NONE) + C::new("raster.process", "Process", "Analyze › Raster", process).inputs(process_inputs).roles(&[]).effects(crate::policy::Effects::NONE) .params(r#"{"layer": raster, "operation": "clip"|"resample", "extent"?: [minLon, minLat, maxLon, maxLat] (clip; the view when omitted), "polygon"?: polygon layer (clip to its selected or all polygons; cells outside become no-data, or see-through in a raster with alpha or a three-band colour one without no-data), "selectedOnly"?: bool (clip to selected polygons when true, all when false), "factor"?: n (resample: n×n pixels become one), "name"?: output, "ran"?: (internal: a raster the app has worked out)}"#), - C::new("raster.mosaic", "Mosaic Rasters", "Imagery › Imagery Tools", raster_mosaic).inputs(mosaic_inputs).roles(&[]).effects(crate::policy::Effects::NONE.with(crate::policy::Effect::Files)).params( + C::new("raster.mosaic", "Mosaic Rasters", "Analyze › Raster", raster_mosaic).inputs(mosaic_inputs).roles(&[]).effects(crate::policy::Effects::NONE.with(crate::policy::Effect::Files)).params( r#"{"inputs": [raster layer or file path, …] (two or more, in one coordinate system and cell size; where they overlap the first wins), "name"?: output, "path"?: GeoTIFF to write the mosaic to}"#, ), C::new("raster.editPixels", "Pixel Editor", "Imagery › Imagery Tools", edit_pixels).inputs(raster_inputs).roles(&[]).effects(crate::policy::Effects::NONE) diff --git a/crates/engine/src/extensions.rs b/crates/engine/src/extensions.rs index 30f2cba2df..df669539a8 100644 --- a/crates/engine/src/extensions.rs +++ b/crates/engine/src/extensions.rs @@ -35,7 +35,8 @@ pub struct Extension { } /// Imagery: orthomosaics, surface models, georeferencing, image analysis and classification, -/// deep learning, mensuration and hosted imagery, on a tab of its own. +/// deep learning, mensuration and hosted imagery, on a tab of its own. Clip, resample, mosaic, project +/// and rasterize serve any raster, so no extension owns them (#2823). pub const IMAGERY: Extension = Extension { id: "imagery", name: "Imagery", @@ -55,8 +56,6 @@ pub const IMAGERY: Extension = Extension { "raster.classify", "raster.classifySupervised", "raster.index", - "raster.process", - "raster.mosaic", "raster.editPixels", "raster.measure", "raster.measurements", @@ -241,6 +240,21 @@ mod tests { assert!(chosen.is_on("imagery")); } + /// Clip, resample, mosaic, project and rasterize serve any raster (#2823): no extension owns them. + #[test] + fn general_raster_commands_are_in_no_extension() { + let (apps, _) = State::from_setting(None); + let registry = crate::cmd::all(); + for c in ["raster.process", "raster.mosaic", "raster.project", "raster.rasterize"] { + assert_eq!(owner(c).map(|e| e.id), None, "{c}"); + assert_eq!(apps.blocks(c), None); + assert_eq!(registry.iter().find(|s| s.id == c).map(|s| s.location), Some("Analyze › Raster"), "{c}"); + } + for c in IMAGERY.commands { + assert!(apps.blocks(c).is_some_and(|w| w.starts_with(c)), "{c}"); + } + } + #[test] fn defaults_choices_and_unknown_ids() { let mut st = State::default(); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 18ae501128..6946fda44d 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -20178,6 +20178,73 @@ fn plugin_mosaics_of_project_layers_need_no_files() { rustgis_plugins::unload("eng-mosaic"); } +/// Clip, resample and mosaic run while the Imagery extension is off (#2823), whoever asks: the user, +/// a script, a saved task, or a plugin, which can't turn the extension on. Imagery's own commands +/// stay refused. +#[test] +fn clip_resample_and_mosaic_run_with_imagery_off() { + use rustgis_data::raster::{ColorHint, Crs, GeoTransform, Raster, geotiff}; + let mut s = world(); + for (name, x0) in [("west", 0.0), ("east", 1.0)] { + let gt = GeoTransform { origin_x: x0, origin_y: 1.0, pixel_width: 0.1, pixel_height: -0.1 }; + let r = Raster::new(name, 10, 10, vec![vec![1.0; 100]], gt, Crs::LonLat, None, ColorHint::Gray, "Float32").unwrap(); + let bytes = geotiff::write(&r, 0).unwrap(); + crate::cmd::raster::add_raster(&mut s, name, rustgis_map::RasterLayer::from_bytes(r, format!("{name}.tif"), bytes)).unwrap(); + } + s.run("layer.template", &json!({"template": "polygons", "name": "Area"})).unwrap(); + // Around the cell centres of 4 columns and 5 rows. + let ring = json!([[0.2, 0.3], [0.6, 0.3], [0.6, 0.8], [0.2, 0.8], [0.2, 0.3]]); + s.run("edit.addFeature", &json!({"layer": "Area", "geometry": {"type": "Polygon", "coordinates": [ring]}})).unwrap(); + s.run("extension.disable", &json!({"id": "imagery"})).unwrap(); + + let commands = |by: &str| { + [ + ("raster.process", json!({"layer": "west", "operation": "clip", "polygon": "Area", "name": format!("{by} clip")})), + ("raster.process", json!({"layer": "west", "operation": "resample", "factor": 2, "name": format!("{by} half")})), + ("raster.mosaic", json!({"inputs": ["west", "east"], "name": format!("{by} both")})), + ] + }; + let check = |s: &Session, by: &str| { + for (kind, size, cells) in [("clip", (4, 5), 20), ("half", (5, 5), 25), ("both", (20, 10), 200)] { + let name = format!("{by} {kind}"); + let layer = s.map().layer_by_name(&name).unwrap_or_else(|| panic!("no {name}")); + let r = layer.raster.as_ref().unwrap().data.as_ref().unwrap(); + assert_eq!(((r.width, r.height), r.bands[0].stats.count), (size, cells), "{name}"); + } + }; + for (id, p) in commands("user") { + s.run(id, &p).unwrap(); + } + check(&s, "user"); + let script = commands("script").map(|(id, p)| format!("{id} {p}")).join("\n"); + s.run("script.run", &json!({"script": script})).unwrap(); + check(&s, "script"); + let steps = commands("task").map(|(id, p)| json!({"title": id, "command": id, "params": p})); + s.run("task.new", &json!({"name": "Raster steps", "steps": steps})).unwrap(); + s.run("task.run", &json!({"task": "Raster steps"})).unwrap(); + check(&s, "task"); + plugin("eng-imagery-off", &["edit"]); + for (id, p) in commands("plugin") { + forward(&mut s, "eng-imagery-off", id, p).unwrap(); + } + check(&s, "plugin"); + // The run the app makes on a thread. + #[cfg(not(target_arch = "wasm32"))] + for (id, p) in commands("thread").into_iter().take(2) { + s.start_raster(id, &p).unwrap(); + } + + for id in ["raster.classify", "raster.index", "raster.change", "raster.editPixels"] { + let p = json!({"layer": "west"}); + for e in [s.run(id, &p).unwrap_err(), forward(&mut s, "eng-imagery-off", id, p).unwrap_err()] { + assert!(e.contains("Imagery extension, which is off"), "{id}: {e}"); + } + } + forward(&mut s, "eng-imagery-off", "extension.enable", json!({"id": "imagery"})).unwrap_err(); + assert!(!s.extensions().is_on("imagery"), "a plugin can't turn it on"); + rustgis_plugins::unload("eng-imagery-off"); +} + #[test] fn plugin_tile_layers_need_network() { let mut s = world(); diff --git a/crates/ui-egui/src/analysispane.rs b/crates/ui-egui/src/analysispane.rs index 9e6c27325f..05d5893877 100644 --- a/crates/ui-egui/src/analysispane.rs +++ b/crates/ui-egui/src/analysispane.rs @@ -631,8 +631,8 @@ pub const SECTIONS: &[(&str, &str)] = &[ /// extension is off. pub fn section_extension(section: &str) -> Option<&'static str> { match section { - "georeference" | "change" | "spectral" | "classify" | "supervised" | "deepLearning" | "hosted" | "indices" | "process" - | "pixels" | "mensuration" | "ortho" | "reality" => Some(rustgis_engine::extensions::IMAGERY.id), + "georeference" | "change" | "spectral" | "classify" | "supervised" | "deepLearning" | "hosted" | "indices" | "pixels" + | "mensuration" | "ortho" | "reality" => Some(rustgis_engine::extensions::IMAGERY.id), _ => None, } } diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 5e60137f42..86d3acfe32 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -1768,6 +1768,21 @@ pub fn notices(app: &mut RustGisApp, ctx: &egui::Context) { mod tests { use super::*; + /// A command and the Workflows section it opens are one extension's or no extension's, so + /// Command Search never offers a command whose section is refused, nor hides one whose isn't. + #[test] + fn a_command_and_its_workflows_section_are_in_one_extension() { + let app = RustGisApp::with_sample(); + let mut seen = 0; + for c in &app.session.registry.commands { + let Some(SearchAction::Workflow(section)) = search_action(c.id) else { continue }; + let owner = rustgis_engine::extensions::owner(c.id).map(|e| e.id); + assert_eq!(owner, crate::analysispane::section_extension(section), "{} and {section}", c.id); + seen += 1; + } + assert!(seen > 20, "{seen}"); + } + #[test] fn command_search_matches_localized_labels_and_locations() { let app = RustGisApp::with_sample(); diff --git a/crates/ui-egui/src/extensionsui.rs b/crates/ui-egui/src/extensionsui.rs index 2e517148ce..cbd56055a3 100644 --- a/crates/ui-egui/src/extensionsui.rs +++ b/crates/ui-egui/src/extensionsui.rs @@ -180,6 +180,9 @@ mod tests { assert!(crate::analysispane::section_shown(&app.session, "rasterFunctions")); let why = app.run("raster.classify", json!({})).unwrap_err(); assert!(why.contains("Imagery extension, which is off"), "{why}"); + // Clip and resample are no extension's (#2823). + app.run("ui.pane.workflows", json!({"section": "process"})).unwrap(); + assert_eq!(app.workflow.section, "process"); // Saved with what a newer version wrote, and read again at the next start. persist(&mut app); @@ -251,6 +254,13 @@ mod tests { assert_eq!(app.ui.tab, "Home"); assert!(said.contains("Imagery extension, which is off"), "{said}"); assert!(app.ui.show_me.is_none()); + // Clip, resample and mosaic are Analyze's (#2823), with the extension off too. + for id in ["raster.process", "raster.mosaic"] { + app.run("ui.tab", json!({"tab": "Home"})).unwrap(); + let said = crate::showme::start(&mut app, &step(id)); + assert_eq!(app.ui.tab, "Analyze", "{said}"); + assert!(app.ui.show_me.is_some(), "{said}"); + } } #[test] diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index e5a9f18d4d..e881e1c33a 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -1857,7 +1857,7 @@ fn analysis_groups(app: &mut RustGisApp, ui: &mut Ui) { let shown: Vec<&(&str, &str)> = crate::analysispane::SECTIONS .iter() .filter(|s| { - !matches!(s.0, "rasterFunctions" | "functionEditor" | "environments" | "models") + !matches!(s.0, "rasterFunctions" | "functionEditor" | "process" | "environments" | "models") && crate::analysispane::section_shown(&app.session, s.0) }) .collect(); @@ -1889,6 +1889,16 @@ fn analysis_groups(app: &mut RustGisApp, ui: &mut Ui) { json!({"section": "functionEditor"}), false, ); + small( + ui, + app, + "resample", + "Process", + "Clip a raster to polygons or the view, or resample it.", + "ui.pane.workflows", + json!({"section": "process"}), + false, + ); }); }); group(ui, "Tools", |ui| { @@ -4852,7 +4862,6 @@ fn imagery_groups(app: &mut RustGisApp, ui: &mut Ui) { }); group(ui, "Imagery Tools", |ui| { col(ui, |ui| { - small(ui, app, "resample", "Process", "Clip a raster to the view, or resample it.", "ui.pane.workflows", wf("process"), false); small(ui, app, "stretch", "Indices", "NDVI, NDWI, SAVI, NBR, NDBI, EVI.", "ui.pane.workflows", wf("indices"), false); small(ui, app, "edit", "Pixel Editor", "Set the pixels inside a polygon.", "ui.pane.workflows", wf("pixels"), false); }); diff --git a/crates/ui-egui/tests/smoke.rs b/crates/ui-egui/tests/smoke.rs index 450425ca6b..ee999e6f5e 100644 --- a/crates/ui-egui/tests/smoke.rs +++ b/crates/ui-egui/tests/smoke.rs @@ -682,6 +682,38 @@ fn polygon_clip_defaults_to_selection_and_honors_opt_out() { assert_eq!(h.state().workflow.selected_only, Some(true)); } +/// Process (clip and resample) is on the Analyze tab and in the Workflows pane whether or not the +/// Imagery extension is on (#2823), and not on its tab. +#[test] +fn process_is_on_the_analyze_tab_with_imagery_off_and_on() { + for (on, command) in [(false, "extension.disable"), (true, "extension.enable")] { + let mut h = harness(); + h.set_size(egui::vec2(2400.0, 860.0)); + h.state_mut().run(command, json!({"id": "imagery"})).unwrap(); + h.state_mut().run("ui.tab", json!({"tab": "Analyze"})).unwrap(); + h.run_steps(4); + h.get_by_label("Process").click(); + h.run_steps(4); + assert_eq!((h.state().workflow.section, h.state().ui.right), ("process", Some(rustgis_ui_egui::RightPane::Workflows))); + // The pane's list of sections. + let rows = |h: &egui_kittest::Harness<'_, RustGisApp>, label| h.query_all_by_label(label).count(); + let (process, indices) = (rows(&h, "Process"), rows(&h, "Indices")); + h.query_all_by_role(egui::accesskit::Role::ComboBox).find(|n| n.value().as_deref() == Some("Process")).unwrap().click(); + h.run_steps(4); + assert_eq!(rows(&h, "Process"), process + 1, "Imagery {on}"); + assert_eq!(rows(&h, "Indices"), indices + usize::from(on), "Imagery {on}"); + if on { + h.key_press(egui::Key::Escape); + h.run_steps(2); + h.state_mut().ui.right = None; + h.state_mut().run("ui.tab", json!({"tab": "extension:imagery"})).unwrap(); + h.run_steps(4); + assert!(h.query_by_label("Pixel Editor").is_some()); + assert!(h.query_by_label("Process").is_none(), "the button is on Analyze alone"); + } + } +} + #[cfg(not(target_arch = "wasm32"))] #[test] fn mcp_relay_early_start_wakes_queued_request_and_updates_ui() { diff --git a/docs/user-guide/analysis.md b/docs/user-guide/analysis.md index 4160c06438..e67d2a88ab 100644 --- a/docs/user-guide/analysis.md +++ b/docs/user-guide/analysis.md @@ -1605,6 +1605,7 @@ click them on the map: | --- | --- | | Raster Functions | Slope in degrees or percent, aspect, hillshade (8-bit shades from 1 to 255, with 0 for no data), NDVI, band math (`(b4-b3)/(b4+b3)`), remapping, thresholds, resampling | | Function Editor | Chains raster functions, each on the previous output | +| Process | Clips a raster to the view or to a polygon layer, or resamples it ([below](#imagery)) | | Suitability Modeler | Scores rasters 1–10 and adds them with weights | | Visibility Analysis | A viewshed from a point on an elevation raster, with the Earth's curvature and the refraction of visible light (1/7, as `gdal_viewshed`). The ground along each ray is the cell each point falls in by default; `heights: "bilinear"` (**Ground heights › Between cells (bilinear)** in the Workflows pane) reads it between the cells' centres instead. Both are estimates of the ground between cell centres; between cells is closer on ground that bulges (a hill seen from its top), where the nearest cell can hide cells just inside the horizon. With no radius, or one longer than the raster's diagonal, the viewshed covers the whole raster. The map's **Viewshed N km Here** reads the ground as the Workflows pane's **Ground heights** says. On a raster round the whole Earth the rays don't cross its east–west edge, which the analysis says when the radius reaches it and the way across is shorter: the ground just across the edge is left out, worked out the long way round where the radius reaches the far edge through the raster too (always with no radius), or partly both, near the observer's row and not farther from it. The observer's height must be from 0 to 10,000 m. Ground with no data hides nothing, and next to it bilinear heights take the nearest cell's height; the analysis says how many cells this touched, in a notice. The answer gives both counts (0 when there is nothing to say): `acrossNoData` counts the visible cells whose rays crossed ground with no data (a hidden cell stays hidden whatever that ground is, so it isn't counted, and 0 doesn't mean no ray crossed any); `readNearest` counts every cell, visible or hidden, whose ray took a nearest height next to no data in bilinear mode | | Exploratory 3D Analysis | A line of sight between two points, split into seen and hidden parts, with the same curvature and refraction | @@ -1977,7 +1978,10 @@ save and run models without the canvas: ## Imagery The Imagery tab's groups open their tools in the Workflows pane. The tab belongs to the Imagery -[extension](index.md#extensions): turn it on in Plugins › Extensions to show the tab: +[extension](index.md#extensions): turn it on in Plugins › Extensions to show the tab. Four raster +commands described here aren't part of the extension and run whether or not it is on: **Process** +(the Raster group of the Analyze tab), **Mosaic Rasters**, **Project Raster** and **Polygons to +Raster**. - **Ortho Mapping** and **Reality Mapping** workspaces mosaic georeferenced images into an orthomosaic, or elevation rasters into a surface model that exports as a 3D mesh (OBJ). @@ -2046,9 +2050,10 @@ The Imagery tab's groups open their tools in the Workflows pane. The tab belongs every answer has the band names and, when the file gives any, `"wavelengths"` in nanometres. After GeoLibre's spectral profile. - **Change Detection** (difference, ratio, percent), **Indices** (NDVI, NDWI, SAVI, NBR, NDBI, - EVI), **Process** (clip to the view, to a box, or to a polygon layer's selected or all polygons, - with the cells outside them no-data; resample) and the **Pixel Editor** (set the pixels inside a - polygon). As in Project Raster, the cells outside the polygons are see-through instead (0, with + EVI) and the **Pixel Editor** (set the pixels inside a polygon). +- **Process** (`raster.process`, Analyze › Raster) clips to the view, to a box, or to a polygon + layer's selected or all polygons, with the cells outside them no-data, or resamples. + As in Project Raster, the cells outside the polygons are see-through instead (0, with alpha 0) in an image with an alpha band, and a three-band colour image with neither alpha nor no-data gains one for them, so an 8-bit image stays 8-bit when it is exported. A colour image with a fourth band of data and no alpha (RGB and near-infrared) gets no-data there as before @@ -2058,7 +2063,8 @@ The Imagery tab's groups open their tools in the Workflows pane. The tab belongs has: clip the others the same way, or mosaic first and clip the result. - **Mosaic Rasters** (`raster.mosaic`) merges tiles of one grid, such as the 1 km tiles of a state elevation model, into one raster in their own coordinate system and cell size, optionally - written to a GeoTIFF: `{"inputs": ["dgm_1.tif", "dgm_2.tif", …], "path": "dem.tif"}`. Inputs + written to a GeoTIFF: `{"inputs": ["dgm_1.tif", "dgm_2.tif", …], "path": "dem.tif"}`. It has no + pane yet: run it from the Script pane, the AI Assistant, the command line or Python. Inputs are layers or file paths; where they overlap, the first one with data wins. Tiles in different coordinate systems or cell sizes, or opened from an overview, are refused rather than quietly resampled, as are tiles whose cells don't line up; the mosaic has to fit in memory (120 million @@ -2394,8 +2400,9 @@ overlapping zones each require a separate pass over their raster window. For `raster.process` polygon clipping, `selectedOnly: true` requires a selection, `selectedOnly: false` uses every polygon, and omitting it uses the selection when present. -The Process pane initially checks Selected only when the chosen layer has a selection, and sends -the choice explicitly. Clipping and Zonal Statistics share +The Process section of the Workflows pane (Analyze › Raster › Process) initially checks Selected +only when the chosen layer has a selection, and sends the choice explicitly. Clipping and Zonal +Statistics share polygon transformation rules so a failed hole cannot silently enlarge the sampled area. A malformed ring or a failed projection rejects its complete polygon part in all raster masking operations. Clipping skips invalid features and reports their count in the command result; diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index ec73cc5674..3208c9759a 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -162,7 +162,7 @@ Review copied diagnostics for private layer names or file paths before sharing t | **Style** | For the layer selected in Layers. A feature layer: Visibility Range, Effects, Drawing, Drawing Effects, Extrusion for polygons (with Faces and Light and Shadow once on) and Layer. A raster layer: Visibility Range, Effects, Compare, Raster Effects, Rendering, Enhancement and Layer. Both: Styles | | **Labeling** | For the feature layer selected in Layers: Labels (Label, Properties), Label Class (Class, Field), Text Symbol (Size, Color, Bold, Halo), Label Placement and Label Range. Whatever is selected: Map Labeling (Lock, Pause, View Unplaced, Convert) | | **Edit** | Manage Edits (Edit, Save, Undo, Redo, Status, Save to PostGIS and Discard PostGIS Edits on the desktop while a [PostGIS layer is loaded for editing](data.md#editing-postgis-tables), Settings, Templates, Topology), Snapping, Features (Create, Delete, Edit Vertices, Modify), Tools, Elevation, Corrections, Graphics, Graphics and Text, Clipboard | -| **Analyze** | Geoprocessing (History, Tools, Model Builder, Script, SQL, Environments), Tasks (the Tasks pane; Task: Record Task, New Task From History, Import Task, run a task), AI (AI Assistant), Portal (Feature Analysis, Raster Analysis), Workflows, Raster (Raster Functions, Function Editor), Tools (the tool gallery), Selection, Notebook | +| **Analyze** | Geoprocessing (History, Tools, Model Builder, Script, SQL, Environments), Tasks (the Tasks pane; Task: Record Task, New Task From History, Import Task, run a task), AI (AI Assistant), Portal (Feature Analysis, Raster Analysis), Workflows, Raster (Raster Functions, Function Editor, Process), Tools (the tool gallery), Selection, Notebook | | **View** | Display (Graticule, GPU Rendering), View (Globe, Projection, Global; Local on the desktop), Effects, Scene, Windows, Navigation, Link, Workspace, Animation, Time (Time Slider), Profile (Profile; Time Series on the desktop) | | **Publish** | While a layout is open, its groups first (Page, Map Frames, Map Surrounds, Shapes, Text, Export); then Report, Presentation, Output (Export Map, Export Features, Print Map, Capture To Clipboard, Report, Presentation, Export To 3D), Package, Share As, Layout, Save As, Thumbnail | | **Plugins** | Plugins (Plugin Manager, Install From File, Browse Plugins), Extensions (the [Extensions](#extensions) window), plus a group for each enabled [plugin](../plugins.md) with commands or tools; a plugin with its own tab adds that tab instead | @@ -182,7 +182,7 @@ what it adds and where it shows. An extension with a tab of its own adds that ta | Extension | Default | Adds | | --- | --- | --- | -| **Imagery** (`imagery`) | Off | The Imagery tab: Ortho Mapping, Reality Mapping, Alignment (Georeference), Image Analysis, Image Classification (with Deep Learning Tools), Imagery Sharing, Mensuration and Imagery Tools, and their commands (`imagery.*`, `dl.*`, and the `raster.*` commands those groups run) | +| **Imagery** (`imagery`) | Off | The Imagery tab: Ortho Mapping, Reality Mapping, Alignment (Georeference), Image Analysis, Image Classification (with Deep Learning Tools), Imagery Sharing, Mensuration and Imagery Tools (Indices, Pixel Editor), and their commands (`imagery.*`, `dl.*`, and the `raster.*` commands those groups run). Process (clip and resample a raster), Mosaic Rasters, Project Raster and Polygons to Raster aren't part of it and always run | While an extension is off, its tab, its buttons, its Workflows pane sections and its commands in Command Search and the AI Assistant's command search are hidden. Its commands are refused with a From c2c8a48670d46f49ed586a7c781ac60c1a36d158 Mon Sep 17 00:00:00 2001 From: elpidioassinaturas Date: Tue, 24 Nov 2026 00:10:55 -0300 Subject: [PATCH 2/3] test(extensions): run clip and resample in the background to the end (#2823) The background leg only started the runs; it now works them out on a thread, lands them and checks the rasters. Rewraps a paragraph of analysis.md. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/tests.rs | 19 ++++++++++++++++--- docs/user-guide/analysis.md | 5 ++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 6946fda44d..7bb0869e47 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -20228,10 +20228,23 @@ fn clip_resample_and_mosaic_run_with_imagery_off() { forward(&mut s, "eng-imagery-off", id, p).unwrap(); } check(&s, "plugin"); - // The run the app makes on a thread. + // As the desktop app runs clip and resample: worked out on a thread, landed, then added by the + // command. A mosaic has no such run. #[cfg(not(target_arch = "wasm32"))] - for (id, p) in commands("thread").into_iter().take(2) { - s.start_raster(id, &p).unwrap(); + { + use crate::cmd::workflows::{raster_land, raster_start}; + for (id, p) in commands("app") { + if id == "raster.mosaic" { + s.run(id, &p).unwrap(); + continue; + } + let run = raster_start(&mut s, id, &p).unwrap(); + let ran = run.id; + let made = std::thread::spawn(move || run.run(&rustgis_analysis::control::Control::new())).join().unwrap().unwrap(); + assert_eq!(raster_land(&mut s, ran, made), Ok(true)); + s.finish_raster(id, ran, &p).unwrap(); + } + check(&s, "app"); } for id in ["raster.classify", "raster.index", "raster.change", "raster.editPixels"] { diff --git a/docs/user-guide/analysis.md b/docs/user-guide/analysis.md index e67d2a88ab..554209d9a4 100644 --- a/docs/user-guide/analysis.md +++ b/docs/user-guide/analysis.md @@ -2402,9 +2402,8 @@ For `raster.process` polygon clipping, `selectedOnly: true` requires a selection `selectedOnly: false` uses every polygon, and omitting it uses the selection when present. The Process section of the Workflows pane (Analyze › Raster › Process) initially checks Selected only when the chosen layer has a selection, and sends the choice explicitly. Clipping and Zonal -Statistics share -polygon transformation rules so a failed hole cannot silently enlarge the sampled area. -A malformed ring or a failed projection rejects its complete polygon part in all raster masking +Statistics share polygon transformation rules so a failed hole cannot silently enlarge the sampled +area. A malformed ring or a failed projection rejects its complete polygon part in all raster masking operations. Clipping skips invalid features and reports their count in the command result; its output bounds cover the valid polygons only. From 2b10a01e308f9922ae602de7659ac8e8d244d880 Mon Sep 17 00:00:00 2001 From: elpidioassinaturas Date: Wed, 25 Nov 2026 03:09:13 -0300 Subject: [PATCH 3/3] docs: describe Process outside the Imagery section (#2823) Co-Authored-By: Claude Opus 5.5 --- docs/user-guide/analysis.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/user-guide/analysis.md b/docs/user-guide/analysis.md index 554209d9a4..999c32c978 100644 --- a/docs/user-guide/analysis.md +++ b/docs/user-guide/analysis.md @@ -1605,7 +1605,7 @@ click them on the map: | --- | --- | | Raster Functions | Slope in degrees or percent, aspect, hillshade (8-bit shades from 1 to 255, with 0 for no data), NDVI, band math (`(b4-b3)/(b4+b3)`), remapping, thresholds, resampling | | Function Editor | Chains raster functions, each on the previous output | -| Process | Clips a raster to the view or to a polygon layer, or resamples it ([below](#imagery)) | +| Process | Clips a raster to the view or to a polygon layer, or resamples it ([below](#zonal-statistics-and-polygon-clipping)) | | Suitability Modeler | Scores rasters 1–10 and adds them with weights | | Visibility Analysis | A viewshed from a point on an elevation raster, with the Earth's curvature and the refraction of visible light (1/7, as `gdal_viewshed`). The ground along each ray is the cell each point falls in by default; `heights: "bilinear"` (**Ground heights › Between cells (bilinear)** in the Workflows pane) reads it between the cells' centres instead. Both are estimates of the ground between cell centres; between cells is closer on ground that bulges (a hill seen from its top), where the nearest cell can hide cells just inside the horizon. With no radius, or one longer than the raster's diagonal, the viewshed covers the whole raster. The map's **Viewshed N km Here** reads the ground as the Workflows pane's **Ground heights** says. On a raster round the whole Earth the rays don't cross its east–west edge, which the analysis says when the radius reaches it and the way across is shorter: the ground just across the edge is left out, worked out the long way round where the radius reaches the far edge through the raster too (always with no radius), or partly both, near the observer's row and not farther from it. The observer's height must be from 0 to 10,000 m. Ground with no data hides nothing, and next to it bilinear heights take the nearest cell's height; the analysis says how many cells this touched, in a notice. The answer gives both counts (0 when there is nothing to say): `acrossNoData` counts the visible cells whose rays crossed ground with no data (a hidden cell stays hidden whatever that ground is, so it isn't counted, and 0 doesn't mean no ray crossed any); `readNearest` counts every cell, visible or hidden, whose ray took a nearest height next to no data in bilinear mode | | Exploratory 3D Analysis | A line of sight between two points, split into seen and hidden parts, with the same curvature and refraction | @@ -1978,10 +1978,10 @@ save and run models without the canvas: ## Imagery The Imagery tab's groups open their tools in the Workflows pane. The tab belongs to the Imagery -[extension](index.md#extensions): turn it on in Plugins › Extensions to show the tab. Four raster -commands described here aren't part of the extension and run whether or not it is on: **Process** -(the Raster group of the Analyze tab), **Mosaic Rasters**, **Project Raster** and **Polygons to -Raster**. +[extension](index.md#extensions): turn it on in Plugins › Extensions to show the tab. Three +commands described here aren't on the tab or part of the extension, and run whether or not it is on: +**Mosaic Rasters**, **Project Raster** and **Polygons to Raster**. So does +[Process](#zonal-statistics-and-polygon-clipping), on the Analyze tab. - **Ortho Mapping** and **Reality Mapping** workspaces mosaic georeferenced images into an orthomosaic, or elevation rasters into a surface model that exports as a 3D mesh (OBJ). @@ -2051,16 +2051,6 @@ Raster**. After GeoLibre's spectral profile. - **Change Detection** (difference, ratio, percent), **Indices** (NDVI, NDWI, SAVI, NBR, NDBI, EVI) and the **Pixel Editor** (set the pixels inside a polygon). -- **Process** (`raster.process`, Analyze › Raster) clips to the view, to a box, or to a polygon - layer's selected or all polygons, with the cells outside them no-data, or resamples. - As in Project Raster, the cells outside the polygons are see-through instead (0, with - alpha 0) in an image with an alpha band, and a three-band colour image with neither alpha nor - no-data gains one for them, so an 8-bit image stays 8-bit when it is exported. A colour image - with a fourth band of data and no alpha (RGB and near-infrared) gets no-data there as before - (−3.4e38 when it has none). Project Raster doesn't give it an alpha band either: a colour image's - alpha is read from its fourth band, which holds its data. A clip that gained an alpha band has - four bands, so Mosaic Rasters refuses it beside three-band tiles, saying how many bands each - has: clip the others the same way, or mosaic first and clip the result. - **Mosaic Rasters** (`raster.mosaic`) merges tiles of one grid, such as the 1 km tiles of a state elevation model, into one raster in their own coordinate system and cell size, optionally written to a GeoTIFF: `{"inputs": ["dgm_1.tif", "dgm_2.tif", …], "path": "dem.tif"}`. It has no @@ -2398,6 +2388,17 @@ statistics. If a part subsequently fails projection onto the raster grid, it is statistics cover the remaining valid parts. Large overlapping zones each require a separate pass over their raster window. +**Process** (`raster.process`, Analyze › Raster) clips a raster to the view, to a box, or to a +polygon layer's selected or all polygons, with the cells outside them no-data, or resamples it. +As in [Project Raster](#imagery), the cells outside the polygons are see-through instead (0, with +alpha 0) in an image with an alpha band, and a three-band colour image with neither alpha nor +no-data gains one for them, so an 8-bit image stays 8-bit when it is exported. A colour image +with a fourth band of data and no alpha (RGB and near-infrared) gets no-data there as before +(−3.4e38 when it has none). Project Raster doesn't give it an alpha band either: a colour image's +alpha is read from its fourth band, which holds its data. A clip that gained an alpha band has +four bands, so Mosaic Rasters refuses it beside three-band tiles, saying how many bands each +has: clip the others the same way, or mosaic first and clip the result. + For `raster.process` polygon clipping, `selectedOnly: true` requires a selection, `selectedOnly: false` uses every polygon, and omitting it uses the selection when present. The Process section of the Workflows pane (Analyze › Raster › Process) initially checks Selected