From 635b2179e6cb2f96344a42efa9ab72e559cd32ee Mon Sep 17 00:00:00 2001 From: giswqs Date: Sat, 21 Nov 2026 23:22:01 -0500 Subject: [PATCH 1/3] chore(sweep): data fixes from the release quality pass - CityGML: a ` Option> { Some(written_attribute("srsDimension", value).into()) } +/// Whether the ` bool { + // The error is placed at the `<` of the markup. + usize::try_from(at).ok().and_then(|at| text.get(at..)).is_some_and(|rest| rest.trim_end() == ") -> usize { usize::try_from(reader.buffer_position()).unwrap_or(usize::MAX) } @@ -740,7 +747,10 @@ impl Index { // A syntax error is the text ending inside markup (a tag, a comment): a file cut // short, as one cut between tags is. But for ` { + // The ` + { let at = usize::try_from(reader.error_position()).unwrap_or(usize::MAX); in_root_end = depth == 1 && text.get(at..).is_some_and(|rest| rest.starts_with(" { + let (unknown, other) = if a.is_none() { (first.as_str(), srs) } else { (srs, first.as_str()) }; + let both = if a.is_none() && b.is_none() { "two coordinate systems" } else { "a coordinate system" }; + let then = if self.archive { + "which aren't read together in a model in an archive" + } else { + "which aren't read together; give the coordinate system (crs) to read it in one" + }; + Err(DataError::Unsupported(format!( + "{file_name}: it names {both} RustGIS doesn't know ({} beside {}), {then}", + cut(unknown), + cut(other) + ))) + } _ if self.archive => Err(DataError::Unsupported(format!( "{file_name}: it names different coordinate systems ({} and {}), which aren't read together; in an archive a model keeps the systems it names, so a coordinate system given doesn't apply to it", cut(first), @@ -2599,7 +2624,7 @@ impl<'a, 'i> Walk<'_, 'a, 'i> { fn implicit(&mut self, g: &Node<'a, 'i>) -> Option<()> { if self.local { // A prototype's geometries are GML's: one that is an implicit geometry places nothing. - self.counts.unknown.insert("ImplicitGeometry in a prototype".to_string()); + self.counts.nested_instances += 1; return Some(()); } let at = elements(*g).find(|c| local(c) == "referencePoint")?; diff --git a/crates/data/src/citygml/tests.rs b/crates/data/src/citygml/tests.rs index 4d2ea0dcdd..1c99b89fad 100644 --- a/crates/data/src/citygml/tests.rs +++ b/crates/data/src/citygml/tests.rs @@ -210,6 +210,13 @@ fn a_compound_system_is_read_by_its_horizontal_part() { let other = inner.replace("EPSG:25832", "EPSG:25833"); let err = read("model.gml", &model("EPSG:25832", &building("b1", &other)), None).unwrap_err().to_string(); assert!(err.contains("different coordinate systems (EPSG:25832 and EPSG:25833)"), "{err}"); + // One RustGIS doesn't know beside a known one: said as unknown, not as another system. + let unknown = inner.replace("EPSG:25832", "EPSG:999999"); + let err = read("model.gml", &model("EPSG:25832", &building("b1", &unknown)), None).unwrap_err().to_string(); + assert!(err.contains("a coordinate system RustGIS doesn't know (EPSG:999999 beside EPSG:25832)"), "{err}"); + assert!(err.contains("give the coordinate system (crs)") && !err.contains("different coordinate systems"), "{err}"); + // Given one, it is read in it. + assert!(read("model.gml", &model("EPSG:25832", &building("b1", &unknown)), Some(Crs::Epsg(25832))).is_ok()); } /// A compound system's vertical part is said when its heights aren't metres upward: another unit, a @@ -1109,6 +1116,11 @@ fn a_file_broken_in_the_middle_is_refused() { // Markup that `".to_string(), building("b2", &box_surfaces("b2"))].concat()); assert!(read("model.gml", &bang, None).is_err()); + // Broken in the middle and ending at `".to_string(), building("b2", &box_surfaces("b2"))].concat()); let cut = whole.windows(4).position(|w| w == b"