fix(map): bound overview feature payloads
This commit is contained in:
@@ -45,6 +45,7 @@ import {
|
||||
selectionAnalysisScale,
|
||||
selectionAreaSquareMetres,
|
||||
selectionDimensions,
|
||||
selectionFeatureLimit,
|
||||
selectionMetricLabel,
|
||||
splitSelectionBbox,
|
||||
} from './mapWorkspaceUtils'
|
||||
@@ -1830,12 +1831,14 @@ export function MapWorkspace({
|
||||
}
|
||||
}
|
||||
const availableThemes: Array<MapThemeQuery<DataThemeId>> = []
|
||||
const resultFeatureLimit = selectionFeatureLimit(bbox)
|
||||
for (const theme of DATA_THEMES) {
|
||||
const dataset = themeDatasetMap[theme.id]
|
||||
if (dataset && persistedDatasetSupportsSelection(dataset, bbox)) {
|
||||
availableThemes.push({
|
||||
themeId: theme.id,
|
||||
dataset,
|
||||
featureLimit: resultFeatureLimit,
|
||||
partitioned: regionalScopeSelected
|
||||
&& (isPartitionedRaster(dataset) || isPartitionedBathymetry(dataset)),
|
||||
})
|
||||
@@ -1852,6 +1855,7 @@ export function MapWorkspace({
|
||||
displayName: onDemandProduct.displayName,
|
||||
},
|
||||
acquisitionBboxes: onDemandProduct.acquisitionBboxes,
|
||||
featureLimit: resultFeatureLimit,
|
||||
})
|
||||
}
|
||||
continue
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
selectionAnalysisScale,
|
||||
selectionAreaSquareMetres,
|
||||
selectionDimensions,
|
||||
selectionFeatureLimit,
|
||||
splitSelectionBbox,
|
||||
} from './mapWorkspaceUtils'
|
||||
import type { VectorSelectionBBox, VectorSelectionResponse } from '../../types'
|
||||
@@ -156,5 +157,7 @@ describe('map workspace selection guards', () => {
|
||||
{ dataset_type: 'vector', source_name: 'statbel' },
|
||||
overview,
|
||||
)).toBe(true)
|
||||
expect(selectionFeatureLimit(overview)).toBe(25)
|
||||
expect(selectionFeatureLimit({ ...overview, min_x: 5, max_x: 5.1, min_y: 51, max_y: 51.1 })).toBe(1000)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -117,6 +117,13 @@ export function persistedDatasetSupportsSelection(
|
||||
return scale === 'detail'
|
||||
}
|
||||
|
||||
export function selectionFeatureLimit(bbox: VectorSelectionBBox): number {
|
||||
const scale = selectionAnalysisScale(bbox)
|
||||
if (scale === 'overview') return 25
|
||||
if (scale === 'regional') return 250
|
||||
return 1000
|
||||
}
|
||||
|
||||
export function splitSelectionBbox(
|
||||
bbox: VectorSelectionBBox,
|
||||
maxTileSideMetres = 18_000,
|
||||
|
||||
Reference in New Issue
Block a user