From 7f2c4c8670c1c72615b8cf3a47bf5515ed98f2e5 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 10 Nov 2026 19:31:01 -0700 Subject: [PATCH 1/7] fix(engine): a clipped 8-bit colour raster stays 8-bit (#1731) Clip to polygons gave the cells it cuts out the raster's no-data, or -3.4e38 when it had none, whatever its pixel type. Bytes can't hold that, so both GeoTIFF writers fell back to 32-bit floats, and the COG writer, which marks empty pixels with the alpha band, left -3.4e38 untagged in every band: the issue's Float32 orthophoto. The cells outside are now left as Project Raster leaves cells it has no value for: in a raster with alpha they are see-through, 0 in every band, and an RGB image with neither alpha nor no-data gains an alpha band ("Alpha", 255 or 0) for them. The no-data value is unchanged, so an 8-bit image stays 8-bit. Any other raster works as before. --- crates/engine/src/cmd/imagery.rs | 47 +++++++++++------- crates/engine/src/tests.rs | 81 ++++++++++++++++++++++++++++++++ docs/user-guide/analysis.md | 4 +- 3 files changed, 113 insertions(+), 19 deletions(-) diff --git a/crates/engine/src/cmd/imagery.rs b/crates/engine/src/cmd/imagery.rs index 9391cbb44e..f5b5fcc28d 100644 --- a/crates/engine/src/cmd/imagery.rs +++ b/crates/engine/src/cmd/imagery.rs @@ -66,7 +66,7 @@ pub fn commands() -> Vec { 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", "Analyze › Imagery Tools", 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), "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)}"#), + .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 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", "Analyze › Imagery Tools", 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}"#, ), @@ -1129,7 +1129,8 @@ pub(crate) fn index_work(s: &Session, p: &Value) -> Result Result<(), String> { } /// The cells of `r` in a column and row window, as a new raster on the same grid. With a mask -/// (row-major over the window), the cells it leaves out become no-data. +/// (row-major over the window), the cells it leaves out have no value, as Project Raster leaves +/// the cells outside its source (`rustgis_analysis::warp`): in a raster with alpha they are +/// see-through, 0 in every band, and a colour raster with neither alpha nor no-data gains an alpha +/// band for them, so an 8-bit image stays 8-bit (#1731). Otherwise they are its no-data, or +/// -3.4e38 when it has none. fn clip_window( r: &Raster, cols: std::ops::Range, @@ -1558,11 +1563,17 @@ fn clip_window( ) -> Result { r.require_coordinates()?; let (w, h) = (cols.end.saturating_sub(cols.start), rows.end.saturating_sub(rows.start)); - let nodata = if mask.is_some() { r.nodata.or(Some(NODATA as f64)) } else { r.nodata }; - let fill = nodata.map(|v| v as f32).unwrap_or(NODATA); + let n = r.bands.len(); + let has_alpha = matches!(r.color, ColorHint::Rgb { alpha: true } if n >= 4) || matches!(r.color, ColorHint::GrayAlpha if n >= 2); + let add_alpha = mask.is_some() && !has_alpha && matches!(r.color, ColorHint::Rgb { .. }) && n == 3 && r.nodata.is_none(); + let clear = mask.is_some() && (has_alpha || add_alpha); + let nodata = if mask.is_some() && !clear { r.nodata.or(Some(NODATA as f64)) } else { r.nodata }; + let fill = if clear { 0.0 } else { nodata.map(|v| v as f32).unwrap_or(NODATA) }; // Each band's cells counted and cancellable, as in a run on another thread. let (wu, width) = (w as usize, r.width as usize); - let bands = r + let kept = |i: usize| mask.is_none_or(|m| m.get(i).copied().unwrap_or(false)); + let at = |i: usize| (rows.start as usize + i / wu.max(1)) * width + cols.start as usize + i % wu.max(1); + let mut bands = r .bands .iter() .map(|b| { @@ -1571,23 +1582,23 @@ fn clip_window( wu, 1, || (), - |_, i| match mask.map(|m| m.get(i).copied().unwrap_or(false)) { - Some(false) => fill, - _ => { - let (row, col) = (rows.start as usize + i / wu.max(1), cols.start as usize + i % wu.max(1)); - b.data.get(row * width + col).copied().unwrap_or(fill) - } - }, + |_, i| if kept(i) { b.data.get(at(i)).copied().unwrap_or(fill) } else { fill }, ) }) .collect::, _>>()?; + if add_alpha { + // Opaque where the cell is kept and has a value in some band, as Project Raster's alpha. + let valued = |i: usize| r.bands.iter().any(|b| b.data.get(at(i)).is_some_and(|v| r.is_valid(*v))); + bands.push(rasterops::per_index(wu * h as usize, wu, n, || (), |_, i| if kept(i) && valued(i) { 255.0 } else { 0.0 })?); + } let o = r.transform.to_world(f64::from(cols.start), f64::from(rows.start)); let gt = GeoTransform { origin_x: o.x, origin_y: o.y, ..r.transform }; - let mut out = Raster::new(name, w, h, bands, gt, r.crs, nodata, r.color.clone(), r.data_type.clone()).map_err(|e| e.to_string())?; - out.bands.iter_mut().zip(&r.bands).for_each(|(o, i)| { - o.name = i.name.clone(); - o.wavelength = i.wavelength; - }); + let color = if add_alpha { ColorHint::Rgb { alpha: true } } else { r.color.clone() }; + let mut out = Raster::new(name, w, h, bands, gt, r.crs, nodata, color, r.data_type.clone()).map_err(|e| e.to_string())?; + for (i, band) in out.bands.iter_mut().enumerate() { + band.name = r.bands.get(i).map_or_else(|| "Alpha".to_string(), |b| b.name.clone()); + band.wavelength = r.bands.get(i).and_then(|b| b.wavelength); + } // Some of the values rounded when the file was read may be in the window: how many isn't known. out.keep_rounded_mark(r); Ok(out) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index ce2a94cc22..7c30dca380 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -40656,3 +40656,84 @@ fn a_model_trained_within_the_work_limit_says_so() { .unwrap(); assert_eq!(r["epochs"], 3, "{r}"); } + +/// An 8-bit colour orthophoto clipped to a polygon, as it is or projected (bilinear) first, stays +/// 8-bit, and its exports too, as a COG and a plain GeoTIFF: the cells outside the polygon are +/// see-through, 0 in every band, as Project Raster leaves the cells it has no value for. An RGB +/// image without no-data gains an alpha band for them; one with a no-data value bytes hold keeps it +/// and its three bands (#1731). +#[test] +fn a_clipped_colour_raster_stays_8_bit() { + use rustgis_data::raster::{ColorHint, Crs, GeoTransform, Raster, geotiff}; + let utm = Crs::from_epsg(32611).unwrap(); + let (w, h) = (40u32, 40u32); + let n = (w * h) as usize; + let gt = GeoTransform { origin_x: 500_000.0, origin_y: 4_800_040.0, pixel_width: 1.0, pixel_height: -1.0 }; + let dir = std::env::temp_dir().join(format!("rustgis-clip-colour-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + // Colours 10–249, opaque. + let value = |i: usize, b: usize| if b == 3 { 255.0 } else { (10 + (i * 7 + b * 60) % 240) as f32 }; + for (label, nb, color, nodata) in [ + ("rgba", 4usize, ColorHint::Rgb { alpha: true }, None), + ("rgb", 3, ColorHint::Rgb { alpha: false }, None), + ("rgb with no-data", 3, ColorHint::Rgb { alpha: false }, Some(0.0)), + ] { + let bands: Vec> = (0..nb).map(|b| (0..n).map(|i| value(i, b)).collect()).collect(); + let r = Raster::new("ortho", w, h, bands, gt, utm, nodata, color, "UInt8").unwrap(); + let mut s = Session::new(Project::default()); + let bytes = geotiff::write(&r, 0).unwrap(); + crate::cmd::raster::add_raster(&mut s, "ortho", rustgis_map::RasterLayer::from_bytes(r, "ortho.tif", bytes)).unwrap(); + let tr = utm.transformer().unwrap(); + let ll = |x: f64, y: f64| { + let c = tr.to_lonlat(rustgis_geom::Coord::new(x, y)).unwrap(); + json!([c.x, c.y]) + }; + // A triangle over the upper right of a 30 m square: cells on and above its diagonal. + s.run("layer.template", &json!({"template": "polygons", "name": "Boundary"})).unwrap(); + let ring = [ll(500_005.0, 4_800_035.0), ll(500_035.0, 4_800_035.0), ll(500_035.0, 4_800_005.0), ll(500_005.0, 4_800_035.0)]; + s.run("edit.addFeature", &json!({"layer": "Boundary", "geometry": {"type": "Polygon", "coordinates": [ring]}})).unwrap(); + s.run("raster.project", &json!({"layer": "ortho", "crs": 32611, "cellSize": 0.5, "resampling": "bilinear", "name": "projected"})) + .unwrap(); + for (from, to) in [("ortho", "clipped"), ("projected", "projected clipped")] { + s.run("raster.process", &json!({"layer": from, "operation": "clip", "polygon": "Boundary", "selectedOnly": false, "name": to})) + .unwrap(); + } + // Project Raster adds alpha to an RGB image without no-data, as Clip now does. + let (bands_out, nodata_out) = if nodata.is_some() { (3, nodata) } else { (4, None) }; + for name in ["clipped", "projected clipped"] { + let r = s.map().layer_by_name(name).unwrap().raster.as_ref().unwrap().data.clone().unwrap(); + let what = format!("{label} {name}"); + assert_eq!((r.data_type.as_str(), r.nodata, r.bands.len()), ("UInt8", nodata_out, bands_out), "{what}"); + assert_eq!(r.color, ColorHint::Rgb { alpha: bands_out == 4 }, "{what}"); + // The lower left corner is outside the triangle: 0 in every band. The upper right is + // inside: opaque. + let cell = |row: u32, col: u32| r.bands.iter().map(|b| b.data[(row * r.width + col) as usize]).collect::>(); + assert_eq!(cell(r.height - 1, 0), vec![0.0; bands_out], "{what}"); + let inside = cell(0, r.width - 1); + assert!(inside.iter().take(3).all(|v| (10.0..=249.0).contains(v)), "{what}: {inside:?}"); + if bands_out == 4 { + assert_eq!(inside[3], 255.0, "{what}"); + } + if bands_out == 4 && nb == 3 { + assert_eq!(r.bands[3].name, "Alpha", "{what}"); + } + if name == "clipped" { + // The window starts 5 cells in: its upper right is the source's row 5, column 34. + let i = 5 * w as usize + 34; + assert_eq!( + inside.iter().take(3).copied().collect::>(), + (0..3).map(|b| value(i, b)).collect::>(), + "{what}" + ); + } + for cog in [true, false] { + let path = dir.join(format!("{}-{cog}.tif", what.replace(' ', "_"))); + s.run("share.exportRaster", &json!({"layer": name, "path": path.display().to_string(), "cog": cog})).unwrap(); + let back = geotiff::read(std::io::Cursor::new(std::fs::read(&path).unwrap()), "back").unwrap(); + assert_eq!((back.data_type.as_str(), back.nodata, back.bands.len()), ("UInt8", nodata_out, bands_out), "{what} cog={cog}"); + assert!(back.bands.iter().all(|b| b.data.iter().all(|v| (0.0..=255.0).contains(v))), "{what} cog={cog}"); + } + } + } + std::fs::remove_dir_all(dir).unwrap(); +} diff --git a/docs/user-guide/analysis.md b/docs/user-guide/analysis.md index 118cec3f57..5ca491316c 100644 --- a/docs/user-guide/analysis.md +++ b/docs/user-guide/analysis.md @@ -1486,7 +1486,9 @@ The Analyze tab's imagery groups open their tools in the Workflows pane: - **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). + polygon). 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 colour image with neither alpha nor no-data gains + one for them, so an 8-bit image stays 8-bit when it is exported. - **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 From 3778f695eca2728998b8543f86776f83b08c574e Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 10 Nov 2026 19:37:12 -0700 Subject: [PATCH 2/7] docs(engine): say which colour rasters a clip leaves see-through The see-through cells are for a raster with alpha or a three-band colour one without no-data. A colour image with a fourth band of data and no alpha (RGB and near-infrared) keeps the old path, as Project Raster does, which the guide, the command's params and the doc comment now say. --- crates/engine/src/cmd/imagery.rs | 6 +++--- docs/user-guide/analysis.md | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/imagery.rs b/crates/engine/src/cmd/imagery.rs index f5b5fcc28d..d7d9e9ca56 100644 --- a/crates/engine/src/cmd/imagery.rs +++ b/crates/engine/src/cmd/imagery.rs @@ -66,7 +66,7 @@ pub fn commands() -> Vec { 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", "Analyze › Imagery Tools", 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 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)}"#), + .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", "Analyze › Imagery Tools", 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}"#, ), @@ -1129,8 +1129,8 @@ pub(crate) fn index_work(s: &Session, p: &Value) -> Result Date: Wed, 11 Nov 2026 23:05:59 -0500 Subject: [PATCH 3/7] Address Claude review feedback - clip_window doc comment: only a three-band colour raster without alpha or no-data gains an alpha band, as the code (n == 3) does. --- crates/engine/src/cmd/imagery.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/imagery.rs b/crates/engine/src/cmd/imagery.rs index bedca15602..327575083e 100644 --- a/crates/engine/src/cmd/imagery.rs +++ b/crates/engine/src/cmd/imagery.rs @@ -1551,7 +1551,7 @@ fn mosaic_matches(first: &Raster, r: &Raster) -> Result<(), String> { /// The cells of `r` in a column and row window, as a new raster on the same grid. With a mask /// (row-major over the window), the cells it leaves out have no value, as Project Raster leaves /// the cells outside its source (`rustgis_analysis::warp`): in a raster with alpha they are -/// see-through, 0 in every band, and a colour raster with neither alpha nor no-data gains an alpha +/// see-through, 0 in every band, and a three-band colour raster with neither alpha nor no-data gains an alpha /// band for them, so an 8-bit image stays 8-bit (#1731). Otherwise they are its no-data, or /// -3.4e38 when it has none. fn clip_window( From f4374ae79a424e8ae6cab009b1787ebebf6e68a7 Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Wed, 11 Nov 2026 23:38:46 -0500 Subject: [PATCH 4/7] Address Claude review feedback - Test the grey-with-alpha branch of a polygon clip: UInt8, two bands, no no-data, 0 in both bands outside, grey and alpha kept inside. It fails on main, where the outside cells were -3.4e38. --- crates/engine/src/tests.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 8c602d16df..59d69d18a5 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -41528,6 +41528,44 @@ fn a_model_trained_within_the_work_limit_says_so() { assert_eq!(r["epochs"], 3, "{r}"); } +/// A grey image with alpha clipped to a polygon stays 8-bit with two bands: the cells outside are +/// see-through, 0 in both bands, and the cells inside keep their grey and alpha (#1731). +#[test] +fn a_clipped_grey_raster_with_alpha_stays_8_bit() { + use rustgis_data::raster::{ColorHint, Crs, GeoTransform, Raster, geotiff}; + let utm = Crs::from_epsg(32611).unwrap(); + let (w, h) = (40u32, 40u32); + let n = (w * h) as usize; + let gt = GeoTransform { origin_x: 500_000.0, origin_y: 4_800_040.0, pixel_width: 1.0, pixel_height: -1.0 }; + let grey = |i: usize| (10 + (i * 7) % 240) as f32; + let bands = vec![(0..n).map(grey).collect(), vec![255.0; n]]; + let r = Raster::new("grey", w, h, bands, gt, utm, None, ColorHint::GrayAlpha, "UInt8").unwrap(); + let mut s = Session::new(Project::default()); + let bytes = geotiff::write(&r, 0).unwrap(); + crate::cmd::raster::add_raster(&mut s, "grey", rustgis_map::RasterLayer::from_bytes(r, "grey.tif", bytes)).unwrap(); + let tr = utm.transformer().unwrap(); + let ll = |x: f64, y: f64| { + let c = tr.to_lonlat(rustgis_geom::Coord::new(x, y)).unwrap(); + json!([c.x, c.y]) + }; + // The same triangle as in `a_clipped_colour_raster_stays_8_bit`. + s.run("layer.template", &json!({"template": "polygons", "name": "Boundary"})).unwrap(); + let ring = [ll(500_005.0, 4_800_035.0), ll(500_035.0, 4_800_035.0), ll(500_035.0, 4_800_005.0), ll(500_005.0, 4_800_035.0)]; + s.run("edit.addFeature", &json!({"layer": "Boundary", "geometry": {"type": "Polygon", "coordinates": [ring]}})).unwrap(); + s.run( + "raster.process", + &json!({"layer": "grey", "operation": "clip", "polygon": "Boundary", "selectedOnly": false, "name": "clipped"}), + ) + .unwrap(); + let c = s.map().layer_by_name("clipped").unwrap().raster.as_ref().unwrap().data.clone().unwrap(); + assert_eq!((c.data_type.as_str(), c.nodata, c.bands.len()), ("UInt8", None, 2)); + assert_eq!(c.color, ColorHint::GrayAlpha); + let cell = |row: u32, col: u32| c.bands.iter().map(|b| b.data[(row * c.width + col) as usize]).collect::>(); + assert_eq!(cell(c.height - 1, 0), vec![0.0, 0.0]); + // The window starts 5 cells in: its upper right is the source's row 5, column 34. + assert_eq!(cell(0, c.width - 1), vec![grey(5 * w as usize + 34), 255.0]); +} + /// An 8-bit colour orthophoto clipped to a polygon, as it is or projected (bilinear) first, stays /// 8-bit, and its exports too, as a COG and a plain GeoTIFF: the cells outside the polygon are /// see-through, 0 in every band, as Project Raster leaves the cells it has no value for. An RGB From d73083bf8b77f00ea3e290ed2446e495cd34ed36 Mon Sep 17 00:00:00 2001 From: giswqs Date: Thu, 12 Nov 2026 00:06:47 -0500 Subject: [PATCH 5/7] fix(engine): a clip's added alpha is opaque wherever a band isn't NaN The alpha band a clip adds to a three-band colour raster used Raster::is_valid, so a cell that is infinite in every band came out see-through, where Project Raster (Canvas::set) makes it opaque. The rule is now the same one: see-through only when every band is NaN. --- crates/engine/src/cmd/imagery.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/imagery.rs b/crates/engine/src/cmd/imagery.rs index 327575083e..10df3432d8 100644 --- a/crates/engine/src/cmd/imagery.rs +++ b/crates/engine/src/cmd/imagery.rs @@ -1588,7 +1588,7 @@ fn clip_window( .collect::, _>>()?; if add_alpha { // Opaque where the cell is kept and has a value in some band, as Project Raster's alpha. - let valued = |i: usize| r.bands.iter().any(|b| b.data.get(at(i)).is_some_and(|v| r.is_valid(*v))); + let valued = |i: usize| r.bands.iter().any(|b| b.data.get(at(i)).is_some_and(|v| !v.is_nan())); bands.push(rasterops::per_index(wu * h as usize, wu, n, || (), |_, i| if kept(i) && valued(i) { 255.0 } else { 0.0 })?); } let o = r.transform.to_world(f64::from(cols.start), f64::from(rows.start)); From 804c0470c1bca1d45b1979a6bf449f96cd4a2c4d Mon Sep 17 00:00:00 2001 From: giswqs Date: Thu, 12 Nov 2026 00:32:33 -0500 Subject: [PATCH 6/7] docs: a clip that gained an alpha band doesn't mosaic with RGB tiles Mosaic Rasters refuses inputs whose band counts or alpha roles differ, so the guide says what to do with a clipped three-band image. --- docs/user-guide/analysis.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/analysis.md b/docs/user-guide/analysis.md index 6680e72b5e..f47f48bc39 100644 --- a/docs/user-guide/analysis.md +++ b/docs/user-guide/analysis.md @@ -1508,7 +1508,9 @@ The Imagery tab's groups open their tools in the Workflows pane. The tab belongs 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. + 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 which has the + transparency band: 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 From 22b04fde3a5bf35a9386b52ba74476b0a36e7123 Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Thu, 12 Nov 2026 00:52:33 -0500 Subject: [PATCH 7/7] Address Claude review feedback - Analysis guide: Mosaic Rasters refuses a clip with an added alpha band on its band count, which it checks before the band roles, so its message gives each input's band count. --- docs/user-guide/analysis.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/analysis.md b/docs/user-guide/analysis.md index f47f48bc39..21f5b5ea02 100644 --- a/docs/user-guide/analysis.md +++ b/docs/user-guide/analysis.md @@ -1509,8 +1509,8 @@ The Imagery tab's groups open their tools in the Workflows pane. The tab belongs 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 which has the - transparency band: clip the others the same way, or mosaic first and clip the result. + 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"}`. Inputs