feat: add governed hydrology and historical imagery
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-15 12:17:45 +02:00
parent 5b1156e989
commit fb38eb3e91
32 changed files with 1646 additions and 55 deletions
+44 -1
View File
@@ -5,6 +5,7 @@ import type {
DetectionQaResult,
DetectionRunResponse,
OrthophotoAcquisitionResult,
OrthophotoProductRead,
VectorSelectionBBox,
} from '../types'
import { formatError } from '../lib/formatError'
@@ -87,6 +88,33 @@ export function useMapOrthophotoAnalysis({
const [lastQuality, setLastQuality] = useState<DetectionQaResult | null>(null)
const [lastDetectionCount, setLastDetectionCount] = useState<number | null>(null)
const [lastAnalysisRunId, setLastAnalysisRunId] = useState<string | null>(null)
const [products, setProducts] = useState<OrthophotoProductRead[]>([])
const [selectedProductKey, setSelectedProductKey] = useState('most_recent')
useEffect(() => {
if (!selectedProjectId) {
setProducts([])
return
}
let cancelled = false
void datasetsApi.listOrthophotoProducts(selectedProjectId)
.then((response) => {
if (!cancelled) {
setProducts(response.items)
setSelectedProductKey((current) =>
response.items.some((item) => item.key === current) ? current : response.items[0]?.key ?? 'most_recent',
)
}
})
.catch((caught) => {
if (!cancelled) {
setError(formatError(caught, 'De luchtbeeldcatalogus kon niet worden geladen'))
}
})
return () => {
cancelled = true
}
}, [selectedProjectId])
useEffect(() => {
setStage('idle')
@@ -96,7 +124,7 @@ export function useMapOrthophotoAnalysis({
setLastQuality(null)
setLastDetectionCount(null)
setLastAnalysisRunId(null)
}, [selectionBbox?.min_x, selectionBbox?.min_y, selectionBbox?.max_x, selectionBbox?.max_y])
}, [selectionBbox?.min_x, selectionBbox?.min_y, selectionBbox?.max_x, selectionBbox?.max_y, selectedProductKey])
const run = async (bbox: VectorSelectionBBox): Promise<boolean> => {
if (!selectedProjectId) {
@@ -115,6 +143,7 @@ export function useMapOrthophotoAnalysis({
const job = await datasetsApi.acquireOrthophoto(selectedProjectId, {
bbox,
area_id: selectedAreaId || undefined,
product_key: selectedProductKey,
})
const acquisition = job.result_json as unknown as OrthophotoAcquisitionResult | null
const datasetId = job.output_dataset_id || acquisition?.output_dataset_id
@@ -124,6 +153,14 @@ export function useMapOrthophotoAnalysis({
setLastResult(acquisition)
await loadProjectData(selectedProjectId)
if (!acquisition.supports_detection) {
setStatus(
`${acquisition.display_name} is ingeladen en op de kaart geplaatst. ${acquisition.limitation_message}`,
)
setStage('complete')
return true
}
setStage('detecting')
setStatus('2/3 Lokaal AI-model herkent gebouwen...')
const detection = await prepareAndRunDetection(datasetId)
@@ -169,9 +206,15 @@ export function useMapOrthophotoAnalysis({
status,
error,
lastResult,
imageUrl: lastResult && selectedProjectId
? datasetsApi.orthophotoImageUrl(selectedProjectId, lastResult.output_dataset_id)
: null,
lastQuality,
lastDetectionCount,
lastAnalysisRunId,
products,
selectedProductKey,
setSelectedProductKey,
running: stage === 'acquiring' || stage === 'detecting' || stage === 'validating',
run,
}