diff --git a/crates/data/src/raster/mod.rs b/crates/data/src/raster/mod.rs index 5f853ee4cd..96e367fe3e 100644 --- a/crates/data/src/raster/mod.rs +++ b/crates/data/src/raster/mod.rs @@ -895,6 +895,8 @@ impl Raster { let nd = self.nodata.map(|v| v as f32); let valid = move |v: f32| v.is_finite() && nd.is_none_or(|d| v != d); let overview = self.overview.is_some(); + // Bands whose attribute table's class names aren't used: the file names their classes. + let mut unused_tables = 0usize; // Worked out before the bands change, as a colour band's take its alpha band's values. let (alpha, opaque) = (self.color.alpha(self.bands.len()), alpha_max(&self.data_type)); let mut measured: Vec> = (0..self.bands.len()) @@ -910,8 +912,13 @@ impl Raster { if let Some(d) = p.and_then(|p| p.description.as_ref()) { band.name = d.clone(); } + // A table's names don't replace those the file's own metadata gave. if let Some(p) = p.filter(|p| !p.categories.is_empty()) { - band.classes = p.categories.clone(); + if p.from_table && !band.classes.is_empty() { + unused_tables += 1; + } else { + band.classes = p.categories.clone(); + } } if let Some(w) = p.and_then(|p| p.wavelength) { band.wavelength = Some(w); @@ -920,6 +927,11 @@ impl Raster { band.stats = stats; } } + if unused_tables > 0 { + self.lost.push(format!( + "{from}: {unused_tables} attribute table(s) of class names not read: the file's own metadata names those bands' classes" + )); + } } /// Longitude/latitude bounds, from points along the grid's edges. @@ -1816,6 +1828,38 @@ pub(crate) mod tests { let _ = std::fs::remove_dir_all(&dir); } + #[test] + fn gdal_sidecars_name_classes_from_an_attribute_table() { + let dir = std::env::temp_dir().join(format!("rustgis-pam-rat-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let gt = GeoTransform { origin_x: 10.0, origin_y: 50.0, pixel_width: 0.5, pixel_height: -0.5 }; + let r = Raster::new("lc", 2, 2, vec![vec![1.0, 3.0, 3.0, 1.0]], gt, Crs::LonLat, None, ColorHint::Gray, "UInt8").unwrap(); + let tif = dir.join("lc.tif"); + std::fs::write(&tif, geotiff::write(&r, 0).unwrap()).unwrap(); + let xml = r#" +Value05 +Class_Name22 +1Water3Forest +"#; + std::fs::write(dir.join("lc.tif.aux.xml"), xml).unwrap(); + let back = read_path(&tif).unwrap(); + let b = &back.bands[0]; + assert_eq!(b.classes, ["", "Water", "", "Forest"]); + assert_eq!((b.class_name(1.0), b.class_name(3.0), b.class_name(2.0)), (Some("Water"), Some("Forest"), None)); + assert!(back.lost.is_empty(), "{:?}", back.lost); + // Class names the GeoTIFF gives itself are kept over the table's, and that is said. + let mut named = r.clone(); + named.bands[0].classes = vec![String::new(), "Lake".into()]; + std::fs::write(&tif, geotiff::write(&named, 0).unwrap()).unwrap(); + let own = read_path(&tif).unwrap(); + assert_eq!(own.bands[0].classes, ["", "Lake"]); + assert_eq!( + own.lost, + ["its .aux.xml sidecar: 1 attribute table(s) of class names not read: the file's own metadata names those bands' classes"] + ); + std::fs::remove_dir_all(&dir).ok(); + } + #[test] fn gdal_sidecars_name_classes() { let dir = std::env::temp_dir().join(format!("rustgis-pam-classes-{}", std::process::id())); diff --git a/crates/data/src/raster/pam.rs b/crates/data/src/raster/pam.rs index c9d3ef4f8a..22a7ae6394 100644 --- a/crates/data/src/raster/pam.rs +++ b/crates/data/src/raster/pam.rs @@ -29,6 +29,11 @@ const MAX_BYTES: u64 = 16 << 20; const MAX_BANDS: usize = 65_536; /// Most class names read for a band: one for each value of a 16-bit band. const MAX_CATEGORIES: usize = 65_536; +/// Most rows read from a band's raster attribute table. +const MAX_RAT_ROWS: usize = 262_144; +/// Most class values all of a sidecar's attribute tables hold together (each up to the highest +/// value a table names), so a few bytes of table can't make each of many bands hold 65,536 names. +const MAX_RAT_SLOTS: usize = 1 << 20; /// Longest band description or class name read from GDAL's metadata tag, in characters. const MAX_NAME: usize = 256; @@ -52,6 +57,9 @@ pub struct PamBand { /// The names of the band's classes, by value (GDAL's category names): `categories[v]` names /// value `v`, and is empty when that value has none. Empty when the band names no class. pub categories: Vec, + /// Whether `categories` come from a raster attribute table rather than from category names, + /// which a source the raster already has them from (its GDAL metadata) takes precedence over. + pub from_table: bool, /// The band's central wavelength in nanometres, when the file gives one ([`wavelength_nm`]). pub wavelength: Option, } @@ -282,6 +290,9 @@ fn parse_sidecar(text: &str) -> Result { // Wavelength units given again otherwise for the dataset or a band (the first is read). let mut units_again = other_units(mdi_texts(root, WAVELENGTH_UNITS)); let (mut seen, mut twice) = (std::collections::HashSet::new(), 0usize); + // Raster attribute tables of value ranges, class names of one for a value that isn't a whole + // number from 0 to `MAX_CATEGORIES - 1` or that is named again, and rows past `MAX_RAT_ROWS`. + let mut rat = RatLost::default(); // The unit the dataset gives its bands' wavelengths in, for a band that gives none; a // wavelength of the dataset's own is for no band. let dataset_units = mdi_text(root, WAVELENGTH_UNITS); @@ -364,7 +375,18 @@ fn parse_sidecar(text: &str) -> Result { while categories.last().is_some_and(String::is_empty) { categories.pop(); } - pam.bands.push(PamBand { band, description, nodata, stats, categories, wavelength }); + // Without category names, a raster attribute table's name column names the classes. + // A table beside category names isn't read, and is counted when it names classes too. + let mut from_table = false; + if let Some(table) = b.children().find(|n| n.has_tag_name("GDALRasterAttributeTable")) { + if categories.is_empty() { + categories = table_names(table, &mut kept, &mut rat); + from_table = !categories.is_empty(); + } else { + rat.named += usize::from(name_column(&table_fields(table)).is_some()); + } + } + pam.bands.push(PamBand { band, description, nodata, stats, categories, from_table, wavelength }); } if odd_bands > 0 { pam.lost.push(format!("{odd_bands} band record(s) for no band from 1 to {MAX_BANDS} left out")); @@ -401,12 +423,173 @@ fn parse_sidecar(text: &str) -> Result { if beyond > 0 { pam.lost.push(format!("{beyond} class name(s) past the first {MAX_CATEGORIES} of a band left out")); } + if rat.ranges > 0 { + pam.lost.push(format!("{} attribute table(s) of value ranges not read as class names", rat.ranges)); + } + if rat.unread_tables > 0 { + pam.lost.push(format!( + "{} attribute table(s) with a bin or a field type or usage that isn't a number not read as class names", + rat.unread_tables + )); + } + if rat.text_tables > 0 { + pam.lost.push(format!("{} attribute table(s) with text fields but no name column not read as class names", rat.text_tables)); + } + if rat.odd > 0 { + pam.lost.push(format!( + "{} class name(s) of an attribute table for a value that isn't a whole number from 0 to {} left out", + rat.odd, + MAX_CATEGORIES - 1 + )); + } + if rat.again > 0 { + pam.lost.push(format!("{} class name(s) of an attribute table given again for a value left out (the first is kept)", rat.again)); + } + if rat.rows > 0 { + pam.lost.push(format!("{} attribute table row(s) past the first {MAX_RAT_ROWS} left out", rat.rows)); + } + if rat.over > 0 { + pam.lost.push(format!( + "{} class name(s) of an attribute table past the sidecar's first {MAX_RAT_SLOTS} class values left out", + rat.over + )); + } + if rat.named > 0 { + pam.lost.push(format!("{} attribute table(s) of class names not read: the band's category names are used", rat.named)); + } if cut > 0 { pam.lost.push(format!("{cut} band or class name(s) cut to {MAX_NAME} characters")); } Ok(pam) } +/// What reading raster attribute tables left out, for [`parse_sidecar`] to say, and how many +/// class values they hold so far (against [`MAX_RAT_SLOTS`]). +#[derive(Default)] +struct RatLost { + ranges: usize, + unread_tables: usize, + text_tables: usize, + odd: usize, + again: usize, + rows: usize, + over: usize, + named: usize, + slots: usize, +} + +/// A table's fields, in order: each one's lower-case name, type and usage. +fn table_fields(table: roxmltree::Node<'_, '_>) -> Vec<(String, Option, Option)> { + table + .children() + .filter(|n| n.has_tag_name("FieldDefn")) + .map(|f| { + let text = |tag: &str| f.children().find(|n| n.has_tag_name(tag)).and_then(|n| n.text()).map(str::trim); + ( + text("Name").unwrap_or_default().to_lowercase(), + text("Type").and_then(|t| t.parse().ok()), + text("Usage").and_then(|u| u.parse().ok()), + ) + }) + .collect() +} + +/// The field of a table's class names: the one GDAL gives the name usage, else a text field +/// called `Class_Name` and the like. +fn name_column(fields: &[(String, Option, Option)]) -> Option { + const NAMES: [&str; 6] = ["class_name", "classname", "class_names", "class", "name", "label"]; + fields.iter().position(|f| f.2 == Some(2)).or_else(|| fields.iter().position(|f| f.1 == Some(2) && NAMES.contains(&f.0.as_str()))) +} + +/// Whether a field's type or usage is given but isn't a number, so which column GDAL means by its +/// usage can't be told. +fn odd_field_numbers(table: roxmltree::Node<'_, '_>) -> bool { + table.children().filter(|n| n.has_tag_name("FieldDefn")).any(|f| { + ["Type", "Usage"].iter().any(|&tag| { + f.children() + .find(|n| n.has_tag_name(tag)) + .and_then(|n| n.text()) + .map(str::trim) + .is_some_and(|t| !t.is_empty() && t.parse::().is_err()) + }) + }) +} + +/// The class names a GDAL raster attribute table holds, by value (as `PamBand::categories`). +/// The names are in its [`name_column`]. A table whose bins or field types or usages aren't +/// numbers isn't read, and neither is one with a text field but no name column: both are counted, +/// as those could hold names. A table with neither names nothing and loses nothing. A +/// row's value is its value field (the min-max usage, else one called `Value`); without one, the +/// whole number in its unit bin when the table gives linear binning (`Row0Min` and `BinSize`, +/// row `index` from `Row0Min`), else its `index` (GDAL's convention for a table with no value +/// field). A table of value ranges (bins wider than 1, or a min or a max with no value) can't +/// name single values and is counted. +fn table_names(table: roxmltree::Node<'_, '_>, kept: &mut dyn FnMut(&str) -> String, lost: &mut RatLost) -> Vec { + let fields = table_fields(table); + // A bin that isn't a number (or a non-finite `Row0Min`) would number the rows without a notice. + let bin_odd = table.attribute("Row0Min").is_some_and(|v| v.trim().parse::().ok().is_none_or(|v| !v.is_finite())) + || table.attribute("BinSize").is_some_and(|v| v.trim().parse::().is_err()); + if bin_odd || odd_field_numbers(table) { + lost.unread_tables += 1; + return Vec::new(); + } + let Some(name_at) = name_column(&fields) else { + lost.text_tables += usize::from(fields.iter().any(|f| f.1 == Some(2))); + return Vec::new(); + }; + let value_at = fields.iter().position(|f| f.2 == Some(5)).or_else(|| fields.iter().position(|f| f.0 == "value")); + let (min, bin) = ( + table.attribute("Row0Min").and_then(|v| v.trim().parse::().ok()).filter(|v| v.is_finite()), + table.attribute("BinSize").and_then(|v| v.trim().parse::().ok()), + ); + let binned = min.zip(bin); + let has = |usage| fields.iter().any(|f| f.2 == Some(usage)); + let wide = bin.is_some_and(|b| b != 1.0); + if wide || (value_at.is_none() && binned.is_none() && (has(3) || has(4))) { + lost.ranges += 1; + return Vec::new(); + } + let rows: Vec<_> = table.children().filter(|n| n.has_tag_name("Row")).collect(); + lost.rows += rows.len().saturating_sub(MAX_RAT_ROWS); + let mut categories: Vec = Vec::new(); + for (i, row) in rows.iter().take(MAX_RAT_ROWS).enumerate() { + let cell = + |at: usize| row.children().filter(|n| n.has_tag_name("F")).nth(at).and_then(|n| n.text()).map(str::trim).unwrap_or_default(); + let name = cell(name_at); + if name.is_empty() { + continue; + } + // The row's number as the file gives it, else its place. + let index = row.attribute("index").map_or(Some(i as f64), |v| v.trim().parse::().ok().map(|v| v as f64)); + let value = match (value_at, binned) { + (Some(at), _) => cell(at).parse::().ok(), + // The whole number in the unit bin [Row0Min + index, Row0Min + index + 1). + (None, Some((m, _))) => index.map(|r| (m + r).ceil()), + (None, None) => index, + }; + let Some(v) = value.filter(|v| v.fract() == 0.0 && (0.0..MAX_CATEGORIES as f64).contains(v)) else { + lost.odd += 1; + continue; + }; + let v = v as usize; + if categories.get(v).is_some_and(|c| !c.is_empty()) { + lost.again += 1; + continue; + } + if categories.len() <= v { + let grow = v + 1 - categories.len(); + if lost.slots + grow > MAX_RAT_SLOTS { + lost.over += 1; + continue; + } + lost.slots += grow; + categories.resize(v + 1, String::new()); + } + categories[v] = kept(name); + } + categories +} + /// The band descriptions a GeoTIFF holds itself, in GDAL's metadata tag (`GDAL_METADATA`, 42112), /// where GDAL and rasterio write them: `None` when it names no band and loses nothing. /// Its `sample` counts from 0. Class names may be dataset items named `CLASS_`, as the @@ -842,6 +1025,190 @@ mod tests { ); } + /// A band's raster attribute table, as GDAL writes it, from its attributes, fields and rows. + fn table(attrs: &str, fields: &[(&str, u32, u32)], rows: &[&[&str]]) -> String { + let fields: String = fields + .iter() + .enumerate() + .map(|(i, (n, t, u))| format!(r#"{n}{t}{u}"#)) + .collect(); + let rows: String = rows + .iter() + .enumerate() + .map(|(i, r)| format!(r#"{}"#, r.iter().map(|f| format!("{f}")).collect::())) + .collect(); + format!( + r#"{fields}{rows}"# + ) + } + + #[test] + fn a_raster_attribute_table_names_classes() { + let xml = r#" + + Value05 + Count01 + Class_Name22 + 1100Water + 3250 Forest + "#; + let pam = parse(xml).unwrap(); + let b = pam.band(1).unwrap(); + assert_eq!(b.categories, ["", "Water", "", "Forest"]); + assert!(b.from_table && pam.lost.is_empty(), "{:?}", pam.lost); + // The name column is found by its usage, however it is called, else by a name. + let odd = parse(&table("", &[("Value", 0, 5), ("Desc", 2, 2)], &[&["2", "Urban"]])).unwrap(); + assert_eq!(odd.band(1).unwrap().categories, ["", "", "Urban"]); + let named = parse(&table("", &[("VALUE", 0, 0), ("CLASS_NAME", 2, 0)], &[&["1", "Crops"]])).unwrap(); + assert_eq!(named.band(1).unwrap().categories, ["", "Crops"]); + // A table with no name column names nothing and loses nothing. + let none = parse(&table("", &[("Value", 0, 5), ("Count", 0, 1), ("Red", 0, 6)], &[&["1", "5", "9"]])).unwrap(); + assert!(none.band(1).unwrap().categories.is_empty() && none.lost.is_empty(), "{none:?}"); + let number = parse(&table("", &[("Name", 0, 0)], &[&["1"]])).unwrap(); + assert!(number.band(1).unwrap().categories.is_empty() && number.lost.is_empty(), "{number:?}"); + } + + #[test] + fn a_table_without_a_value_column_numbers_its_rows() { + let fields = [("Class_Name", 2, 2), ("Count", 0, 1)]; + let rows: [&[&str]; 3] = [&["zero", "1"], &["", "2"], &["two", "3"]]; + let plain = parse(&table("", &fields, &rows)).unwrap(); + assert_eq!(plain.band(1).unwrap().categories, ["zero", "", "two"]); + let binned = parse(&table(r#"Row0Min="10" BinSize="1""#, &fields, &rows)).unwrap(); + let c = &binned.band(1).unwrap().categories; + assert_eq!((c.len(), c[10].as_str(), c[12].as_str()), (13, "zero", "two")); + assert!(binned.lost.is_empty(), "{:?}", binned.lost); + } + + #[test] + fn a_table_that_cannot_be_read_as_names_is_said() { + let bins_msg = "1 attribute table(s) with a bin or a field type or usage that isn't a number not read as class names"; + let text_msg = "1 attribute table(s) with text fields but no name column not read as class names"; + // A bin that isn't a number would number the rows without a notice. + let bin = parse(&table(r#"Row0Min="x" BinSize="1""#, &[("Name", 2, 2)], &[&["zero"]])).unwrap(); + assert!(bin.band(1).unwrap().categories.is_empty()); + assert_eq!(bin.lost, [bins_msg]); + let wide = parse(&table(r#"BinSize="wide""#, &[("Name", 2, 2)], &[&["zero"]])).unwrap(); + assert_eq!(wide.lost, [bins_msg]); + // A usage that isn't a number may be the name column's. + let usage = r#"Value05Desc2two1one"#; + let usage = parse(usage).unwrap(); + assert!(usage.band(1).unwrap().categories.is_empty()); + assert_eq!(usage.lost, [bins_msg]); + // A text field that no usage or name marks as names is said; a table with none isn't. + let text = parse(&table("", &[("Value", 0, 5), ("Desc", 2, 0)], &[&["2", "Urban"]])).unwrap(); + assert!(text.band(1).unwrap().categories.is_empty()); + assert_eq!(text.lost, [text_msg]); + let plain = parse(&table("", &[("Value", 0, 5), ("Count", 0, 1)], &[&["2", "7"]])).unwrap(); + assert!(plain.lost.is_empty(), "{:?}", plain.lost); + } + + #[test] + fn category_names_win_over_a_table() { + let xml = r#" +ab +Name22 +xyz +"#; + let pam = parse(xml).unwrap(); + assert_eq!(pam.band(1).unwrap().categories, ["a", "b"]); + assert!(!pam.band(1).unwrap().from_table); + assert_eq!(pam.lost, ["1 attribute table(s) of class names not read: the band's category names are used"]); + // A table that names nothing isn't counted. + let counts = xml.replace("22", "01"); + assert!(parse(&counts).unwrap().lost.is_empty()); + } + + #[test] + fn a_tables_rows_keep_their_index_and_unit_bins_name_the_whole_number_in_them() { + // Rows given out of order keep the values of their `index`. + let xml = r#" +Class_Name22 +ForestWater"#; + assert_eq!(parse(xml).unwrap().band(1).unwrap().categories, ["Water", "Forest"]); + // A bin from -0.5 to 0.5 holds 0. + let half = parse(&table(r#"Row0Min="-0.5" BinSize="1""#, &[("Name", 2, 2)], &[&["zero"], &["one"]])).unwrap(); + assert_eq!(half.band(1).unwrap().categories, ["zero", "one"]); + assert!(half.lost.is_empty(), "{:?}", half.lost); + // A value field wins over unit bins; wider bins are ranges even beside one. + let valued = parse(&table(r#"Row0Min="0" BinSize="1""#, &[("Value", 0, 5), ("Name", 2, 2)], &[&["2", "two"]])).unwrap(); + assert_eq!(valued.band(1).unwrap().categories, ["", "", "two"]); + let wide = parse(&table(r#"Row0Min="0" BinSize="10""#, &[("Value", 0, 5), ("Name", 2, 2)], &[&["2", "two"]])).unwrap(); + assert!(wide.band(1).unwrap().categories.is_empty()); + assert_eq!(wide.lost, ["1 attribute table(s) of value ranges not read as class names"]); + } + + #[test] + fn tables_hold_a_bounded_number_of_class_values() { + // Each band's one row at the highest value would hold 65,536 names. + let bands = MAX_RAT_SLOTS / MAX_CATEGORIES + 3; + let band = |b: usize| { + format!( + r#"Value05Name22{}top"#, + MAX_CATEGORIES - 1 + ) + }; + let xml = format!("{}", (1..=bands).map(band).collect::()); + let pam = parse(&xml).unwrap(); + let held: usize = pam.bands.iter().map(|b| b.categories.len()).sum(); + assert!(held <= MAX_RAT_SLOTS, "{held}"); + assert_eq!( + pam.lost, + [format!("3 class name(s) of an attribute table past the sidecar's first {MAX_RAT_SLOTS} class values left out")] + ); + } + + #[test] + fn what_a_table_leaves_out_is_said() { + let ranges = parse(&table("", &[("Min", 0, 3), ("Max", 0, 4), ("Name", 2, 2)], &[&["0", "10", "low"]])).unwrap(); + assert!(ranges.band(1).unwrap().categories.is_empty()); + assert_eq!(ranges.lost, ["1 attribute table(s) of value ranges not read as class names"]); + // One bound alone is a range too. + for usage in [3, 4] { + let one = parse(&table("", &[("Bound", 0, usage), ("Name", 2, 2)], &[&["10", "Forest"]])).unwrap(); + assert!(one.band(1).unwrap().categories.is_empty(), "usage {usage}"); + assert_eq!(one.lost, ["1 attribute table(s) of value ranges not read as class names"], "usage {usage}"); + } + let wide = parse(&table(r#"Row0Min="0" BinSize="10""#, &[("Name", 2, 2)], &[&["low"]])).unwrap(); + assert_eq!(wide.lost, ["1 attribute table(s) of value ranges not read as class names"]); + let odd = parse(&table( + "", + &[("Value", 0, 5), ("Name", 2, 2)], + &[ + &["-1", "neg"], + &["1.5", "frac"], + &["65536", "big"], + &["x", "text"], + &["", "blank"], + &["65535", "last"], + &["4", "four"], + &["4", "again"], + ], + )) + .unwrap(); + let c = &odd.band(1).unwrap().categories; + assert_eq!((c.len(), c[4].as_str(), c[65_535].as_str()), (65_536, "four", "last")); + assert_eq!( + odd.lost, + [ + format!( + "5 class name(s) of an attribute table for a value that isn't a whole number from 0 to {} left out", + MAX_CATEGORIES - 1 + ), + "1 class name(s) of an attribute table given again for a value left out (the first is kept)".to_string(), + ] + ); + let long = parse(&table("", &[("Name", 2, 2)], &[&[&"x".repeat(300)]])).unwrap(); + assert_eq!((long.band(1).unwrap().categories[0].len(), long.lost.len()), (256, 1)); + let many = vec![&["n"][..]; MAX_RAT_ROWS + 3]; + let many = parse(&table("", &[("Name", 2, 2)], &many)).unwrap(); + assert!( + many.lost.iter().any(|l| l == &format!("3 attribute table row(s) past the first {MAX_RAT_ROWS} left out")), + "{:?}", + many.lost + ); + } + #[test] fn junk_is_not_a_sidecar() { // Each names nothing, and says why. diff --git a/docs/user-guide/data.md b/docs/user-guide/data.md index dbe9ba40d6..120fc3907c 100644 --- a/docs/user-guide/data.md +++ b/docs/user-guide/data.md @@ -1224,9 +1224,12 @@ longitude/latitude degrees. On the desktop, a GDAL `.aux.xml` file next to a ras or `dem.aux.xml`) names its bands from their descriptions, gives the no-data value when the file has none, and supplies the band statistics when only an overview of the raster is read. Its category names (GDAL's `SetCategoryNames`, one per value) label the classes in the legend of a -Colormap or Unique Values layer; a value without a name shows the value itself. The band +Colormap or Unique Values layer; a value without a name shows the value itself. Without category +names, the name column of a raster attribute table in the sidecar labels them the same way (a table +of value ranges isn't read, and is said). The band descriptions GDAL and rasterio write inside a GeoTIFF (its `GDAL_METADATA` tag) name its bands -too, a sidecar's taking precedence. +too, a sidecar's taking precedence; a table's names don't replace class names the GeoTIFF itself +gives, or the sidecar's category names, and a table left unread that way is said. Exporting a raster opened from an overview writes that overview; the results of adding and of exporting it (`layer.addData`, `share.exportRaster`) give the full size as `overviewOf`, so scripts and the MCP server see it too. A GeoTIFF read in place that is added before its overview is in