Skip to content

fix: resolve ZH canton drill-category always returning UNKNOWN(4) - #243

Open
monodo wants to merge 1 commit into
mainfrom
fix/zh-canton-drill-category-unknown
Open

monodo wants to merge 1 commit into
mainfrom
fix/zh-canton-drill-category-unknown

Conversation

@monodo

@monodo monodo commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

ZH canton drill-category always resolved to harmonized_value=4 (UNKNOWN). ZH.yaml queried 6 stale per-zone WMS layer names that no longer exist on the live server, plus a 7th layer (erdwaermesonden-auflagen) marked non-queryable by the servers GetCapabilities`.

Fix consolidates ZH.yaml to the one real, queryable layer (waermenutzung-zonen), resolved via a static bbox->zone lookup table (bbox_zones), since GetFeatureInfo returns no attribute payload for it - only a bounding box. erdwaermesonden-auflagen stays in LAYERS (so the request shape matches the real service) but is excluded from QUERY_LAYERS via a new queryable flag.

Changes

  • schema.py: add Layer.queryable and Layer.bbox_zones/BboxZone fields (additive, default-safe for every other canton)
  • ZH.yaml: replace the 7-layer config with waermenutzung-zonen + bbox_zones (coordinates recorded via live GetFeatureInfo queries against the real ZH server)
  • processing.py: split QUERY_LAYERS/LAYERS construction, replace the dead gml:name parsing with gml:Box bbox extraction, add bbox_zones matching in process_ground_category
  • pyproject.toml/uv.lock: add hypothesis as a dev dependency (used by the new preservation property tests)

Known gap

The erdwaermesonden-auflagen restriction remains undetectable - the server rejects GetFeatureInfo against it outright. Ground control point 1 in ZH.yaml keeps its documented expected value of 3; the new integration test explicitly asserts the post-fix result does NOT match 3 (it resolves to 2 via Zone D instead), documenting this as a known, out-of-scope gap for a follow-up fix rather than hiding it.

Testing

  • tests/test_zh_bug_condition.py: exploration tests confirming the bug existed pre-fix, now pass post-fix
  • tests/test_zh_preservation_properties.py: property-based tests confirming non-ZH canton behavior (GML parsing, property_values matching, QUERY_LAYERS/LAYERS construction, transport failures) is byte-for-byte unchanged
  • tests/test_zh_integration.py: full-route tests for all 6 documented ZH ground control points, including the inverted assertion for the known Auflagen gap
  • tests/test_processing.py, tests/test_configuration_structure.py: updated for the new bbox-based ZH parsing and schema fields
  • Full suite: 156 passed, 0 failed
  • ruff check / ruff format --check: clean
  • Manually verified live against the real ZH WMS server via a local dev server run

ZH.yaml queried 6 stale per-zone WMS layer names that no longer exist on
the live server, plus a 7th layer (erdwaermesonden-auflagen) marked
non-queryable by the server's GetCapabilities. Every ZH request fell
back to harmonized_value=4 (UNKNOWN).

Fix: consolidate ZH.yaml to the one real, queryable layer
(waermenutzung-zonen), resolved via a static bbox->zone lookup table
(bbox_zones) since GetFeatureInfo returns no attribute payload for it,
only a bounding box. erdwaermesonden-auflagen stays in LAYERS (to match
the real request shape) but is excluded from QUERY_LAYERS via a new
queryable flag.

- schema.py: add Layer.queryable and Layer.bbox_zones/BboxZone fields
- ZH.yaml: replace 7-layer config with waermenutzung-zonen + bbox_zones
- processing.py: split QUERY_LAYERS/LAYERS, replace dead gml:name parsing
  with gml:Box bbox extraction, add bbox_zones matching in
  process_ground_category

Known gap: the erdwaermesonden-auflagen restriction remains
undetectable (server rejects GetFeatureInfo against it outright).
Ground control point 1 keeps its documented expected value of 3 in
ZH.yaml; the integration test explicitly asserts the post-fix mismatch
(resolves to 2 via Zone D) to document this as a known, out-of-scope
gap rather than hiding it.

Tested: bug condition exploration, preservation (non-ZH behavior
unchanged), and integration tests all pass (156/156).

This branch has not been deployed

No deployments
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