fix(map): keep municipality analysis local
This commit is contained in:
@@ -29,6 +29,7 @@ import {
|
||||
getFeatureBBox,
|
||||
getFeatureCollectionBBox,
|
||||
getFeatureGeometrySummary,
|
||||
isMunicipalityAreaName,
|
||||
isSelectionBoundedDataset,
|
||||
normalizeBboxFromCorners,
|
||||
operationalScopeProjectLabel,
|
||||
@@ -394,10 +395,6 @@ function datasetMatchesTheme(dataset: DatasetCreateResponse, theme: DataTheme):
|
||||
return theme.tokens.some((token) => searchText.includes(token))
|
||||
}
|
||||
|
||||
function isMunicipalityAreaName(name: string | null | undefined): boolean {
|
||||
return /^Gemeente\s/i.test(name ?? '')
|
||||
}
|
||||
|
||||
function isPartitionedRaster(dataset: DatasetCreateResponse | null | undefined): boolean {
|
||||
return Boolean(
|
||||
dataset?.dataset_type === 'raster'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
bboxesEqual,
|
||||
isMunicipalityAreaName,
|
||||
isSelectionBoundedDataset,
|
||||
normalizeBboxFromCorners,
|
||||
parseBboxInput,
|
||||
@@ -65,6 +66,13 @@ describe('map workspace selection guards', () => {
|
||||
expect(productCoversZones(['brussels'], ['wallonia'])).toBe(false)
|
||||
})
|
||||
|
||||
it('recognizes Dutch and release-golden municipality areas as local scope', () => {
|
||||
expect(isMunicipalityAreaName('Gemeente Mol')).toBe(true)
|
||||
expect(isMunicipalityAreaName('RC Golden - Mol municipality')).toBe(true)
|
||||
expect(isMunicipalityAreaName('Flanders')).toBe(false)
|
||||
expect(isMunicipalityAreaName('RC Golden - Kempen region')).toBe(false)
|
||||
})
|
||||
|
||||
it('distinguishes selection-bounded acquisitions from reusable regional datasets', () => {
|
||||
expect(isSelectionBoundedDataset({
|
||||
geometry_clipped_to_selection: true,
|
||||
|
||||
@@ -31,6 +31,11 @@ export function selectedAreaCoverageZones(areaName: string | null | undefined):
|
||||
return null
|
||||
}
|
||||
|
||||
export function isMunicipalityAreaName(areaName: string | null | undefined): boolean {
|
||||
const normalized = String(areaName ?? '').trim()
|
||||
return /^Gemeente\s/i.test(normalized) || /\bmunicipality$/i.test(normalized)
|
||||
}
|
||||
|
||||
export function productCoversZones(productZones: string[], selectedZones: string[] | null): boolean {
|
||||
return selectedZones === null || selectedZones.some((zone) => productZones.includes(zone))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user