Skip to content

Fix false-positive geometry metadata violations on place-less features - #800

Merged
joostfarla merged 1 commit into
mainfrom
fix/json-fg-metadata-placeless-feature
Jun 25, 2026
Merged

Fix false-positive geometry metadata violations on place-less features#800
joostfarla merged 1 commit into
mainfrom
fix/json-fg-metadata-placeless-feature

Conversation

@joostfarla

Copy link
Copy Markdown
Member

Problem

For 3D_polyhedron_dom_FG.json the checker reports /req/prisms/metadata, even though the document contains no (Multi)Prism geometries.

Root cause

The /req/{prisms,polyhedra,circular-arcs}/metadata rules decide whether a document contains a geometry of the relevant type by matching place.type against an enum. The if subschema only used JSON Schema properties, which is vacuously true when the property is absent.

So in the FeatureCollection branch, features.contains matched any feature that simply lacked a place (or had a place with no type). The workshop document's first feature has no place member, so contains was satisfied → the rule demanded the conformance-class URI → false positive. The single-Feature branch had the same latent gap.

This affects all three geometry-type metadata rules; the same place-less feature would also falsely trip polyhedra and circular-arcs.

Fix

Require place (typed as object) and place.type in the matched subschema, so a feature only counts when it actually carries a geometry of the target type. types-schemas already used required in its contains and was unaffected.

Tests

  • Added a regression test to each of the three suites: a FeatureCollection with a place-less feature and no target geometry must not raise the metadata violation.
  • Full json-fg suite passes (107 tests); lint clean.

The `/req/{prisms,polyhedra,circular-arcs}/metadata` rules detect whether a
JSON-FG document contains a geometry of the relevant type by matching
`place.type` against an enum. The `if` subschema only used JSON Schema
`properties`, which is vacuously satisfied when the property is absent.

As a result, a FeatureCollection containing any feature without a `place`
member (or a `place` without a `type`) matched the `features.contains`
subschema, which made the rule demand the conformance-class URI even though
no geometry of that type is present — a false positive.

This is what happens for the OGC workshop document
`3D_polyhedron_dom_FG.json`: its first feature has no `place` member, so the
collection was wrongly flagged with `/req/prisms/metadata` (and would also be
flagged for polyhedra/circular-arcs) despite containing no Prism geometries.

Require `place` (as an object) and `place.type` in the matched subschema so a
feature only counts when it actually carries a geometry of the target type.
Adds regression tests covering a FeatureCollection with a place-less feature.
@joostfarla
joostfarla merged commit e85af51 into main Jun 25, 2026
6 checks passed
@joostfarla
joostfarla deleted the fix/json-fg-metadata-placeless-feature branch June 25, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant