feat: operationalize Flemish land and nature themes
This commit is contained in:
@@ -68,6 +68,10 @@ class ThematicRasterAnalysisService:
|
||||
@staticmethod
|
||||
def _unsupported_metrics(product: ThematicRasterProduct) -> list[str]:
|
||||
if product.metric_kind == "binary_area":
|
||||
if product.theme == "forest":
|
||||
return ["tree_count", "canopy_cover", "timber_volume", "legal_forest_boundary"]
|
||||
if product.theme == "agriculture":
|
||||
return ["declared_parcel_area", "crop_declaration", "ownership", "cadastral_area"]
|
||||
return ["object_count", "parcel_area", "current_land_use"]
|
||||
if product.metric_kind == "population_density":
|
||||
return ["current_population", "household_count", "address_level_population"]
|
||||
@@ -152,7 +156,12 @@ class ThematicRasterAnalysisService:
|
||||
positive_count = int(np.count_nonzero(values >= 0.5))
|
||||
positive_area_ha = positive_count * cell_area_m2 / 10_000.0
|
||||
positive_share = positive_count / max(1, valid_cell_count) * 100.0
|
||||
label = "Ruimtebeslag" if product.theme == "space_occupation" else "Open ruimte"
|
||||
label = {
|
||||
"space_occupation": "Ruimtebeslag",
|
||||
"open_space": "Open ruimte",
|
||||
"forest": "Bos",
|
||||
"agriculture": "Akker en landbouwgrasland",
|
||||
}[product.theme]
|
||||
metrics = [
|
||||
metric(f"{product.theme}_area_ha", f"{label} in selectie", positive_area_ha, "ha", "positive_source_cells_times_cell_area"),
|
||||
metric(f"{product.theme}_share_pct", f"Aandeel {label.lower()}", positive_share, "%", "positive_source_cells_divided_by_valid_selected_cells"),
|
||||
@@ -216,6 +225,8 @@ class ThematicRasterAnalysisService:
|
||||
palettes = {
|
||||
"space_occupation": np.asarray([[251, 231, 211], [190, 62, 51]], dtype="float64"),
|
||||
"open_space": np.asarray([[221, 238, 219], [38, 122, 70]], dtype="float64"),
|
||||
"forest": np.asarray([[223, 237, 226], [43, 117, 72]], dtype="float64"),
|
||||
"agriculture": np.asarray([[245, 237, 204], [166, 122, 35]], dtype="float64"),
|
||||
"population": np.asarray([[238, 231, 246], [103, 58, 151]], dtype="float64"),
|
||||
"accessibility": np.asarray([[233, 241, 244], [15, 118, 110]], dtype="float64"),
|
||||
"services": np.asarray([[255, 244, 191], [182, 109, 22]], dtype="float64"),
|
||||
|
||||
Reference in New Issue
Block a user