feat: complete governed Walloon coverage sources
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-22 03:39:08 +02:00
parent 17d4442e60
commit c2101ea8f9
37 changed files with 1813 additions and 45 deletions
@@ -116,6 +116,9 @@ def test_regional_product_registry_is_explicit_and_source_specific() -> None:
]
assert products["spw_picc_waterways"]["collection"] == "28"
assert products["spw_picc_water_surfaces"]["collection"] == "30"
assert products["spw_flood_hazard_2021"]["collection"] == "2"
assert products["spw_flood_hazard_2021"]["theme"] == "flood_hazard"
assert products["spw_flood_hazard_2021"]["coverage_zones"] == ["wallonia"]
assert products["urbis_buildings"]["coverage_zones"] == ["brussels"]
assert products["urbis_buildings"]["license_note"] == "Buildings are published under CC0."
assert "FPS Finance" in products["urbis_cadastral_parcels"]["license_note"]
@@ -252,6 +255,82 @@ def test_spw_arcgis_paging_is_bounded_stable_and_clipped() -> None:
assert all(item["properties"]["clipped_area_ha"] > 0 for item in features)
def test_spw_flood_hazard_uses_separate_governed_endpoint_and_persists_classification() -> None:
product = OfficialVectorAcquisitionService._product("spw_flood_hazard_2021")
scope = Polygon(
[(4.55, 50.58), (4.56, 50.58), (4.56, 50.59), (4.55, 50.59), (4.55, 50.58)]
)
scope_metric = Polygon(
[_TO_LAMBERT72.transform(x, y) for x, y in scope.exterior.coords]
)
def opener(raw_request, timeout):
assert timeout == 180
parsed = urlparse(raw_request.full_url)
assert parsed.path.endswith("/EAU/ALEA_INOND/MapServer/2/query")
query = parse_qs(parsed.query)
assert query["outSR"] == ["4326"]
return JsonResponse(
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 7,
"geometry": {
"type": "Polygon",
"coordinates": [[
[4.551, 50.581],
[4.559, 50.581],
[4.559, 50.589],
[4.551, 50.589],
[4.551, 50.581],
]],
},
"properties": {
"OBJECTID": 7,
"LOCALID": "ALEA-7",
"TYPEALEA": "Debordement",
"CLASSEMENT": 130,
"MILLESIME": 2021,
},
}
],
"exceededTransferLimit": False,
}
)
features, transfer = OfficialVectorAcquisitionService._fetch_features(
product,
scope,
scope_metric,
"wallonia",
Settings(_env_file=None),
opener,
)
assert transfer["feature_count"] == 1
assert features[0]["id"] == "2:ALEA-7"
assert features[0]["properties"]["CLASSEMENT"] == 130
assert features[0]["properties"]["source_name"] == "spw_flood_hazard"
assert features[0]["properties"]["clipped_area_ha"] > 0
def test_spw_flood_hazard_can_be_disabled_independently() -> None:
project_id = uuid4()
db = FakeSession({(Project, project_id): Project(id=project_id, name="Belgium")})
with pytest.raises(AppError) as exc_info:
OfficialVectorAcquisitionService.acquire(
db,
project_id,
request("spw_flood_hazard_2021", (4.55, 50.58, 4.56, 50.59)),
settings=Settings(_env_file=None, SPW_FLOOD_HAZARD_ENABLED=False),
)
assert exc_info.value.code == "SPW_FLOOD_HAZARD_NOT_CONFIGURED"
def test_regional_products_require_the_persisted_authoritative_coverage_area() -> None:
project_id = uuid4()
db = FakeSession({(Project, project_id): Project(id=project_id, name="Belgium")})