Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ATTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ of use.
|---|---|---|
| Paired binary reader-loss fixtures (`crates/engine/testdata/reading-losses/xy.*`, `xyz.*`) | The RustGIS project: one made-up point, written offline with [GDAL](https://gdal.org) 3.13.3 (FlatGeobuf and FileGDB) and [PyArrow](https://arrow.apache.org/docs/python/) 26.0.1 (GeoParquet); [fixture notes](crates/engine/testdata/reading-losses/README.md) describe the minimal data and retained files | Apache-2.0 |
| Historical release projects and preferences (`crates/engine/testdata/releases/v*.rgis`, `v*.prefs.json`) | The RustGIS project: unchanged output of the published binaries, with made-up layer data. The [fixture README](crates/engine/testdata/releases/README.md) lists writers and archive checksums. | Apache-2.0 |
| OSM PBF ring-loss fixtures (`crates/engine/testdata/reading-losses/hole-*.osm.pbf`) | The RustGIS project: independently encoded, made-up nodes, ways and relation from the published OSM PBF schema; contents and checksums in [OSM.md](crates/engine/testdata/reading-losses/OSM.md) | Apache-2.0 |
| Interface themes (`crates/ui-egui/themes/light.json`, `dark.json`) | The RustGIS project | Apache-2.0 |
| Sample data (`countries`, `cities`, `rivers`, `lakes` GeoJSON), embedded at build time from [rustgis-assets](https://github.com/opengeos/rustgis-assets/tree/main/data) | Natural Earth 1:110m, attributes trimmed | Public domain |
| Worldviews (`countries_<code>.geojson` and `original/countries_<code>.geojson.gz` on [source.coop](https://source.coop/opengeos/data/rustgis/worldviews)), downloaded by the app when one is chosen, not part of it | Natural Earth's Admin 0 Countries (1:10m) and its points of view, with the sample countries' attributes by `scripts/worldviews.py` in [rustgis-assets](https://github.com/opengeos/rustgis-assets): simplified to 1:110m density, or at their original detail | Public domain |
Expand Down
8 changes: 4 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ A result is right, or RustGIS says what it lost or assumed
each vertex's Z in DXF and unreadable coordinates, holes and parts in KML, GeoRSS, MapInfo and
DXF. A fix makes its case `Said` _(open)_.
- Lossy sample files in `never_silent_reading.rs` for the readers it doesn't cover yet:
Shapefile, OSM PBF and spreadsheets. It covers GeoJSON, TopoJSON, CSV, KML, KMZ, GPX, GML,
GeoRSS, DXF, LandXML and MapInfo, with height-loss cases for CityJSON, CityGML, GeoPackage,
FlatGeobuf, GeoParquet and FileGDB; those six still need other loss kinds. Exports are checked
by `never_silent_roundtrip.rs` _(open)_.
Shapefile and spreadsheets. It covers GeoJSON, TopoJSON, CSV, KML, KMZ, GPX, GML, GeoRSS,
DXF, LandXML and MapInfo, with height-loss cases for CityJSON, CityGML, GeoPackage,
FlatGeobuf, GeoParquet and FileGDB, and ring-loss cases for OSM PBF; other loss kinds remain.
Exports are checked by `never_silent_roundtrip.rs` _(open)_.
- A `--strict` option for `rustgis-cli run` that exits non-zero when a loss is reported, for
scheduled jobs. Notices carry a severity but not a kind today (`Notice` in
`crates/engine/src/lib.rs`): start with an issue on which notices count as a loss.
Expand Down
34 changes: 34 additions & 0 deletions crates/engine/testdata/reading-losses/OSM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# OSM PBF ring-loss fixtures

Made-up data, constructed offline with Python's standard library from the published
[OSM PBF schemas](https://github.com/openstreetmap/OSM-binary/tree/master/osmpbf).
No data or implementation from another project is included. Each file has an uncompressed
`OSMHeader` declaring `OsmSchema-V0.6`, then one `OSMData` block. Nodes, ways and the relation
have separate primitive groups. Coordinates use the default 100-nanodegree granularity and
zero offsets. There are no timestamps, user details or downloaded map features.

The clean file has untagged nodes 1–6 at longitude/latitude (0,0), (10,0), (0,10), (1,1),
(2,1), (1,2). Way 10 references [1,2,3,1]; way 20 references [4,5,6,4]. Relation 50 has
`type=multipolygon`, with way 10 as `outer` and way 20 as `inner`. The string table is
["", "type", "multipolygon", "outer", "inner"]. No other tags are present.

Each lossy file changes just one thing:

| File | Difference from `hole-clean.osm.pbf` |
|---|---|
| `hole-missing-member.osm.pbf` | Omit way 20, retaining the relation's reference to it. |
| `hole-missing-node.osm.pbf` | Omit node 6, retaining way 20's reference to it. |
| `hole-unclosed.osm.pbf` | Way 20 references [4,5,6], without its closing node. |
| `hole-outside.osm.pbf` | Move nodes 4–6 to (21,21), (22,21), (21,22). |

The native reader currently produces one polygon with two rings for the clean file and one
ring for each lossy file, without a loss notice. The command corpus records these existing
bugs as `Silent`; this contribution does not fix the reader or certify other OSM loss kinds.

| File | SHA-256 |
|---|---|
| `hole-clean.osm.pbf` | `b5d5a9d0256b5c420005fd9fe08da6bb51d87a896ab5d8e65f2f32d906d86934` |
| `hole-missing-member.osm.pbf` | `773140490c9dbcbb1914db863143b22528700922e07bf58bab24272b7ef1536e` |
| `hole-missing-node.osm.pbf` | `9c1c5e4d483415809e47e1a5c5f1fb1d682e83c98c1351355c78e2fbadebef77` |
| `hole-unclosed.osm.pbf` | `057ac714164461be6ce76960563d7786a40436a57518d26561584bf3480c8cd3` |
| `hole-outside.osm.pbf` | `2b0a1150e2dce48cddcf7533c27a336f054d0f23fbdf26b773bb746c375754dc` |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
34 changes: 32 additions & 2 deletions crates/engine/tests/never_silent_reading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
//! fails here until the case is moved to [`Expect::Said`], so the list only shrinks. Exports have
//! their own test, `never_silent_roundtrip.rs`.
//!
//! The table includes text, CityJSON, CityGML, KMZ, GeoPackage, FlatGeobuf, GeoParquet and FileGDB.
//! More formats and loss kinds remain to add (ROADMAP.md); one loss does not certify a reader.
//! The table includes text, CityJSON, CityGML, KMZ, GeoPackage, FlatGeobuf, GeoParquet, FileGDB
//! and OSM PBF. More formats and loss kinds remain to add (ROADMAP.md); one loss does not
//! certify a reader.
use rustgis_engine::{Project, Session};
use serde_json::json;

Expand Down Expand Up @@ -253,6 +254,35 @@ fn cases(fixture_dir: &std::path::Path) -> Vec<Case> {
gpx(r#"<trk><trkseg><trkpt lat="1" lon="1"/><trkpt lat="2" lon="2"/></trkseg><trkseg><trkpt lat="3" lon="3"/></trkseg></trk>"#),
Silent("the segment is left out of the track's line"),
),
// OSM PBF: keep the outer polygon while one inner member is lost.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quality (test coverage): the OSM cases don't check the geometry they describe. read() returns only notices and whether a layer was added, and a Silent case passes whenever the lossy file adds a layer with no new notice. So if the reader stopped assigning the inner role, or dropped every hole, the clean file and all four lossy files would still import one layer with no notice. All five cases would pass while the corpus stopped covering rings at all. The PR's own probe (clean = one polygon with two rings, each variant one ring) is not in the test suite. Suggested fix: a small dedicated test that reads hole-clean and each lossy file through layer.addData and asserts the ring count per polygon (2 for clean, 1 for each lossy file), so the fixtures' claims are enforced. Confidence: high that the harness can't catch this; the fix is outside this diff's small scope, so the author can decide whether to add it here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The harness checks import success and notices, so it does not enforce ring counts. Before submission, the native-reader probe confirmed one polygon with two rings for the clean file and one ring for each of the four variants, with zero skipped features and no messages. The extra persistent geometry assertions are left for the release quality pass.

case(
"OSM PBF: a missing inner member way",
"a.osm.pbf",
include_bytes!("../testdata/reading-losses/hole-clean.osm.pbf"),
include_bytes!("../testdata/reading-losses/hole-missing-member.osm.pbf"),
Silent("the hole whose member way the file does not hold is left out"),
),
case(
"OSM PBF: a missing inner node",
"a.osm.pbf",
include_bytes!("../testdata/reading-losses/hole-clean.osm.pbf"),
include_bytes!("../testdata/reading-losses/hole-missing-node.osm.pbf"),
Silent("the hole whose member way refers to a missing node is left out"),
),
case(
"OSM PBF: an unclosed inner ring",
"a.osm.pbf",
include_bytes!("../testdata/reading-losses/hole-clean.osm.pbf"),
include_bytes!("../testdata/reading-losses/hole-unclosed.osm.pbf"),
Silent("the inner member way that does not close is left out"),
),
case(
"OSM PBF: an inner ring outside its outer",
"a.osm.pbf",
include_bytes!("../testdata/reading-losses/hole-clean.osm.pbf"),
include_bytes!("../testdata/reading-losses/hole-outside.osm.pbf"),
Silent("the inner ring outside every outer ring is left out"),
),
// GML.
case(
"GML: a height",
Expand Down
Loading