Add governed SPW bathymetry analysis
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
bathymetryRasterImageUrl,
|
||||
bathymetryRasterSelectionToMapSelection,
|
||||
} from './bathymetryRaster'
|
||||
|
||||
describe('bathymetry raster mapping', () => {
|
||||
it('uses the governed image endpoint', () => {
|
||||
expect(bathymetryRasterImageUrl('project-1', 'dataset-1')).toBe(
|
||||
'/api/v1/projects/project-1/datasets/dataset-1/raster/bathymetry/image',
|
||||
)
|
||||
})
|
||||
|
||||
it('maps persisted bed-elevation metrics without turning them into object counts', () => {
|
||||
const mapped = bathymetryRasterSelectionToMapSelection({
|
||||
dataset_id: 'dataset-1',
|
||||
product_key: 'spw_bathymetry_50cm_mdng',
|
||||
selection_bbox: { min_x: 4.85, min_y: 50.45, max_x: 4.87, max_y: 50.47, crs: 'EPSG:4326' },
|
||||
selected_cell_count: 100,
|
||||
valid_cell_count: 25,
|
||||
coverage_ratio: 0.25,
|
||||
resolution_m: 0.5,
|
||||
vertical_reference: 'mDNG',
|
||||
survey_period: '2019-2022',
|
||||
summary: {
|
||||
metric_label: 'Gemiddelde waterbodemhoogte',
|
||||
metric_value: 74.5,
|
||||
metric_unit: 'm mDNG',
|
||||
aggregation_method: 'mean_valid_source_cells',
|
||||
primary_metric_key: 'bed_elevation_mean_m',
|
||||
metrics: [{
|
||||
metric_key: 'bed_elevation_mean_m',
|
||||
metric_label: 'Gemiddelde waterbodemhoogte',
|
||||
metric_value: 74.5,
|
||||
metric_unit: 'm mDNG',
|
||||
aggregation_method: 'mean_valid_source_cells',
|
||||
is_estimate: false,
|
||||
}],
|
||||
},
|
||||
unsupported_metrics: ['current_water_depth_m', 'water_volume_m3'],
|
||||
limitation_message: 'Geen gelijktijdig waterpeil.',
|
||||
generated_at: '2026-07-19T00:00:00Z',
|
||||
})
|
||||
|
||||
expect(mapped.feature_count).toBe(25)
|
||||
expect(mapped.geojson.features).toEqual([])
|
||||
expect(mapped.summary?.primary_metric_key).toBe('bed_elevation_mean_m')
|
||||
expect(mapped.summary?.metric_unit).toBe('m mDNG')
|
||||
expect(mapped.summary?.is_estimate).toBe(false)
|
||||
expect(mapped.summary?.warning).toContain('waterpeil')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { BathymetryRasterSelectionResponse, VectorSelectionResponse } from '../types'
|
||||
|
||||
export function bathymetryRasterImageUrl(projectId: string, datasetId: string): string {
|
||||
return `/api/v1/projects/${projectId}/datasets/${datasetId}/raster/bathymetry/image`
|
||||
}
|
||||
|
||||
export function bathymetryRasterSelectionToMapSelection(
|
||||
result: BathymetryRasterSelectionResponse,
|
||||
): VectorSelectionResponse {
|
||||
return {
|
||||
selection_bbox: result.selection_bbox,
|
||||
selection_area_id: result.selection_area_id,
|
||||
feature_count: result.valid_cell_count,
|
||||
total_feature_count: result.valid_cell_count,
|
||||
limit: 0,
|
||||
truncated: false,
|
||||
geojson: { type: 'FeatureCollection', features: [] },
|
||||
summary: {
|
||||
...result.summary,
|
||||
feature_count: result.valid_cell_count,
|
||||
is_estimate: false,
|
||||
warning: result.limitation_message,
|
||||
metrics: result.summary.metrics.map((metric) => ({
|
||||
...metric,
|
||||
is_estimate: false,
|
||||
})),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ const NON_IMAGERY_RASTER_SOURCES = new Set([
|
||||
'department_omgeving_thematic_raster',
|
||||
'digitaal_vlaanderen_dhmv',
|
||||
'vmm_flood_hazard',
|
||||
'spw_bathymetry',
|
||||
])
|
||||
|
||||
export function isDetectionImageryDataset(dataset: DatasetCreateResponse): boolean {
|
||||
|
||||
@@ -36,6 +36,7 @@ const DATASET_SOURCE_LABELS: Record<string, string> = {
|
||||
waterinfo: 'Waterinfo Vlaanderen',
|
||||
vmm_flood_hazard: 'Vlaamse Milieumaatschappij',
|
||||
vmm_vha_bathymetry_profiles: 'VMM / Vlaamse Hydrografische Atlas',
|
||||
spw_bathymetry: 'Service public de Wallonie',
|
||||
department_omgeving_thematic_raster: 'Departement Omgeving',
|
||||
dov_soil_map: 'Databank Ondergrond Vlaanderen',
|
||||
}
|
||||
@@ -57,6 +58,9 @@ export function getDatasetDisplayName(dataset: DatasetCreateResponse): string {
|
||||
if (dataset.source_name === 'vmm_vha_bathymetry_profiles') {
|
||||
return 'VHA-dwarsprofielen waterbodem'
|
||||
}
|
||||
if (dataset.source_name === 'spw_bathymetry') {
|
||||
return 'SPW waterbodemhoogte 0,5 m'
|
||||
}
|
||||
if (dataset.source_name === 'department_omgeving_thematic_raster') {
|
||||
const productName = dataset.source_metadata?.['product_display_name']
|
||||
return typeof productName === 'string' && productName.trim() ? productName : 'Officieel Vlaams themaraster'
|
||||
|
||||
@@ -414,11 +414,11 @@ export const OFFICIAL_SOURCE_PORTFOLIO: OfficialSourceDefinition[] = [
|
||||
name: 'Waalse vaarweg- en stuwmeerbathymetrie',
|
||||
owner: 'Service public de Wallonie',
|
||||
coverage: 'Gemeten Waalse vaarwegen en stuwmeren, 0,5 m in mDNG',
|
||||
value: 'Hoogwaardige bodemrasters voor federale uitbreiding buiten Vlaanderen.',
|
||||
metricExamples: 'bodemhoogte, diepteprofiel en vergelijkbare meetcampagnes',
|
||||
priority: 'planned',
|
||||
url: 'https://geoportail.wallonie.be/catalogue/c450c28f-d357-48af-8423-62d524632cf9.html',
|
||||
matches: (dataset) => sourceNameIs(dataset, 'spw_walloon_waterway_bathymetry'),
|
||||
value: 'Officiële waterbodemhoogtes voor begrensde analyse buiten Vlaanderen.',
|
||||
metricExamples: 'bodemhoogte, gemeten oppervlakte en brondekking',
|
||||
priority: 'next',
|
||||
url: 'https://geoportail.wallonie.be/catalogue/0a544b42-0b30-4c8e-85e7-38149b99eae0.html',
|
||||
matches: (dataset) => sourceNameIs(dataset, 'spw_bathymetry'),
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user