fix(map): report selected theme scale honestly
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 00:56:58 +02:00
parent 1299ff9dac
commit 46884cbbc9
2 changed files with 18 additions and 28 deletions
@@ -20,7 +20,8 @@ def test_map_first_explorer_is_the_default_product_flow() -> None:
assert "<h3>Inzichten</h3>" in workspace
assert "Teken rechthoek" in workspace
assert "Volledig werkgebied" in workspace
assert "Alle relevante thema" in workspace
assert "Gekozen thema" in workspace
assert "Kies kleiner gebied" in workspace
assert "Bron nog niet ingeladen" in workspace
assert "useMapThemeSelectionInsights" in workspace
assert "datasetsApi.selectVectorFeatures" in read("frontend/src/hooks/useMapThemeSelectionInsights.ts")
+16 -27
View File
@@ -1166,7 +1166,7 @@ export function MapWorkspace({
)
})
}, [coverage, mapSelectionBbox, mapSelectionScale, onDemandProductsForZones, themeDatasetMap])
const unavailableSelectionThemeCount = Math.max(DATA_THEMES.length - selectionRelevantThemes.length, 0)
const activeThemeSupportsCurrentSelection = selectionRelevantThemes.some((theme) => theme.id === activeTheme.id)
const activeOnDemandMapProduct = mapSelectionScale === 'overview' || themeDatasetMap[activeTheme.id]
? null
: onDemandProductMap.get(activeTheme.id) ?? null
@@ -1369,17 +1369,6 @@ export function MapWorkspace({
}),
[themeInsights],
)
const readSelectionThemeCount = useMemo(
() => {
const relevantThemeIds = new Set(selectionRelevantThemes.map((theme) => theme.id))
return new Set(
themeResults
.filter((result) => relevantThemeIds.has(result.theme.id))
.map((result) => result.theme.id),
).size
},
[selectionRelevantThemes, themeResults],
)
const activeThemeInsight = themeResults.find((item) => item.theme.id === activeThemeId)
const activeResultDataset = activeThemeInsight?.dataset ?? activeThemeDataset
const activeSelectionResult = activeThemeInsight?.result
@@ -1425,10 +1414,10 @@ export function MapWorkspace({
const heightKm = dimensions.heightMetres / 1000
if (mapSelectionScale === 'regional') {
const partitionCount = splitSelectionBbox(mapSelectionBbox).length
return `Regionale analyse van ${widthKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} × ${heightKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} km. Geschikte detailbronnen worden automatisch over ${partitionCount} begrensde bronpartities verwerkt; 5 m-rasters worden alleen meegenomen wanneer het veilige pixelbudget volstaat.`
return `Regionale selectie van ${widthKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} x ${heightKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} km. Het gekozen thema kan over maximaal ${partitionCount} begrensde bronpartities worden verwerkt; teken een kleiner gebied wanneer een fijnmazige rasterbron buiten het veilige pixelbudget valt.`
}
if (mapSelectionScale === 'overview') {
return `Overzichtsanalyse van ${widthKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} × ${heightKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} km. Alleen landelijke en vooraf ingeladen bronnen die deze schaal betrouwbaar ondersteunen worden bevraagd. Teken maximaal 50 × 50 km voor regionale thema's of 20 × 20 km voor alle detailbronnen.`
return `Overzichtsselectie van ${widthKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} x ${heightKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} km. Het gekozen detailthema wordt niet automatisch op deze schaal bevraagd. Teken maximaal 50 x 50 km voor regionale thema's en ongeveer 16 x 16 km voor 5 m-rasters.`
}
return null
}, [mapSelectionBbox, mapSelectionScale])
@@ -2685,24 +2674,31 @@ export function MapWorkspace({
<div className="geo-theme-results">
<div className="geo-results-title-row">
<h4>Alle relevante themas</h4>
<span>{readSelectionThemeCount} van {selectionRelevantThemes.length} uitgelezen</span>
<h4>Gekozen thema</h4>
<span>{activeSelectionResult ? 'Uitgelezen' : 'Geen meting'}</span>
</div>
{selectionRelevantThemes.flatMap((theme) => {
{[activeTheme].flatMap((theme) => {
const dataset = themeDatasetMap[theme.id]
const items = themeResults.filter((result) => result.theme.id === theme.id)
const rows = items.length > 0 ? items : [null]
return rows.map((item, index) => {
const resultDataset = item?.dataset ?? dataset
const resultDataset = item?.dataset ?? (activeThemeSupportsCurrentSelection ? dataset : undefined)
const unavailableAtScale = !activeThemeSupportsCurrentSelection
return (
<div className="geo-theme-result-row" key={`${theme.id}:${resultDataset?.id ?? index}`}>
<span className={`geo-theme-symbol geo-theme-symbol-${theme.id}`} aria-hidden="true" />
<span>
<strong>{theme.label}</strong>
<small>{resultDataset ? getDatasetSourceDisplayName(resultDataset) : 'Officiële bron kon niet worden geladen'}</small>
<small>
{resultDataset
? getDatasetSourceDisplayName(resultDataset)
: unavailableAtScale
? 'Niet geschikt voor deze selectieschaal of zone'
: 'Bronanalyse niet voltooid'}
</small>
</span>
<span className="geo-theme-result-value">
<b>{item ? resultMetricLabel(item.result) : 'Inladen mislukt'}</b>
<b>{item ? resultMetricLabel(item.result) : unavailableAtScale ? 'Kies kleiner gebied' : 'Geen meting'}</b>
{item?.result.summary ? <small>{item.result.summary.metric_label}</small> : null}
</span>
</div>
@@ -2712,13 +2708,6 @@ export function MapWorkspace({
{selectionScaleNotice ? (
<p className="geo-data-notice">{selectionScaleNotice}</p>
) : null}
{unavailableSelectionThemeCount > 0 ? (
<p className="geo-data-notice">
{mapSelectionScale === 'overview'
? `${unavailableSelectionThemeCount} detailthema's zijn op deze overzichtsschaal bewust niet bevraagd.`
: `${unavailableSelectionThemeCount} thema's zijn voor deze zone niet van toepassing, niet operationeel gekoppeld of te fijnmazig voor deze selectieschaal.`}
</p>
) : null}
</div>
</>
)}