Expand BWK nature data across Kempen
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-16 00:20:45 +02:00
parent 9db0ac7811
commit 6cb880c76e
16 changed files with 988 additions and 5 deletions
+14 -4
View File
@@ -319,7 +319,15 @@ def habitat_breakdown(properties: dict[str, Any]) -> tuple[list[dict[str, Any]],
return entries, min(natura_share, 100.0), min(regional_share, 100.0), min(uncertain_share, 100.0)
def normalize_feature(feature: dict[str, Any], boundary_lambert72) -> tuple[dict[str, Any] | None, bool]:
def normalize_feature(
feature: dict[str, Any],
boundary_lambert72,
*,
municipality: str = "Mol",
nis_code: str = "13025",
coverage_scope: str = "municipality",
feature_id_suffix: str | None = None,
) -> tuple[dict[str, Any] | None, bool]:
geometry_payload = feature.get("geometry")
if not geometry_payload:
return None, False
@@ -342,6 +350,8 @@ def normalize_feature(feature: dict[str, Any], boundary_lambert72) -> tuple[dict
if not source_id:
source_id = sha256_bytes(json.dumps(geometry_payload, sort_keys=True).encode("utf-8"))
stable_id = f"BWK:Bwkhab:{raw_properties.get('UIDN') or source_id}"
if feature_id_suffix:
stable_id = f"{stable_id}:{feature_id_suffix}"
evaluation_code = str(raw_properties.get("EVAL") or "").strip().lower()
habitat_status = str(raw_properties.get("HABLEGENDE") or "").strip().lower()
habitats, natura_share, regional_share, uncertain_share = habitat_breakdown(raw_properties)
@@ -357,9 +367,9 @@ def normalize_feature(feature: dict[str, Any], boundary_lambert72) -> tuple[dict
"reference_layer_name": "nature_value",
"theme": "nature_value",
"authority_level": "authoritative",
"coverage_scope": "municipality",
"municipality": "Mol",
"nis_code": "13025",
"coverage_scope": coverage_scope,
"municipality": municipality,
"nis_code": nis_code,
"source_version": SOURCE_VERSION,
"attribution": ATTRIBUTION,
"bwk_evaluation_code": evaluation_code or "unknown",