Add QA evidence map overlay
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-06-25 03:17:49 +02:00
parent 7a54d01993
commit b9674a0e42
16 changed files with 778 additions and 4 deletions
+82 -1
View File
@@ -7,6 +7,7 @@ interface GeoMapProps {
areaData?: GeoJSON.FeatureCollection | null
selectedFeature?: GeoJSON.Feature | null
selectionData?: GeoJSON.FeatureCollection | null
qaEvidenceData?: GeoJSON.FeatureCollection | null
selectionBbox?: { min_x: number; min_y: number; max_x: number; max_y: number } | null
bboxSelectionMode?: boolean
visible?: boolean
@@ -97,6 +98,7 @@ function GeoMap({
areaData = null,
selectedFeature = null,
selectionData = null,
qaEvidenceData = null,
selectionBbox = null,
bboxSelectionMode = false,
visible = true,
@@ -148,7 +150,18 @@ function GeoMap({
onMapCoordinateSelectRef.current?.([event.lngLat.lng, event.lngLat.lat])
return
}
const layers = ['dataset-fill', 'dataset-line', 'area-fill', 'area-line'].filter((layerId) => map.getLayer(layerId))
const layers = [
'qa-evidence-fill',
'qa-evidence-line',
'qa-evidence-circle',
'selection-result-fill',
'selection-result-line',
'selection-result-circle',
'dataset-fill',
'dataset-line',
'area-fill',
'area-line',
].filter((layerId) => map.getLayer(layerId))
if (layers.length === 0) {
onFeatureSelectRef.current?.(null)
return
@@ -463,6 +476,74 @@ function GeoMap({
})
}, [selectionData, mapStyleReady])
useEffect(() => {
const map = mapRef.current
if (!map || !mapStyleReady || !map.isStyleLoaded()) {
return
}
const evidenceCollection = qaEvidenceData ?? EMPTY_FEATURE_COLLECTION
if (map.getSource('qa-evidence')) {
;(map.getSource('qa-evidence') as maplibregl.GeoJSONSource).setData(evidenceCollection)
return
}
map.addSource('qa-evidence', { type: 'geojson', data: evidenceCollection })
const evidenceColor = [
'match',
['get', 'qa_evidence_role'],
'match_candidate',
'#2563eb',
'match_reference',
'#0f766e',
'false_positive',
'#dc2626',
'false_negative',
'#d97706',
'#475569',
] as maplibregl.ExpressionSpecification
map.addLayer({
id: 'qa-evidence-fill',
type: 'fill',
source: 'qa-evidence',
filter: ['match', ['geometry-type'], ['Polygon', 'MultiPolygon'], true, false],
paint: {
'fill-color': evidenceColor,
'fill-opacity': 0.28,
},
})
map.addLayer({
id: 'qa-evidence-line',
type: 'line',
source: 'qa-evidence',
filter: ['match', ['geometry-type'], ['Polygon', 'MultiPolygon', 'LineString', 'MultiLineString'], true, false],
paint: {
'line-color': evidenceColor,
'line-width': [
'match',
['get', 'qa_evidence_role'],
'false_positive',
4,
'false_negative',
4,
3,
],
},
})
map.addLayer({
id: 'qa-evidence-circle',
type: 'circle',
source: 'qa-evidence',
filter: ['match', ['geometry-type'], ['Point', 'MultiPoint'], true, false],
paint: {
'circle-color': evidenceColor,
'circle-radius': 7,
'circle-stroke-color': '#ffffff',
'circle-stroke-width': 2,
},
})
}, [qaEvidenceData, mapStyleReady])
return <div className="map-container" ref={containerRef} />
}