Keep map selections within active areas
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-16 14:35:16 +02:00
parent e48d6c9873
commit 2723043e3d
7 changed files with 28 additions and 12 deletions
+9 -10
View File
@@ -676,7 +676,7 @@ interface MapWorkspaceProps {
onRunMapSelectionExtract: (bbox: VectorSelectionBBox, areaId?: string) => Promise<VectorSelectionResponse | null>
onClearMapSelectionExtract: () => void
onExportMapSelection: (bbox: VectorSelectionBBox) => Promise<unknown>
onDeriveMapSelectionDataset: (bbox: VectorSelectionBBox) => Promise<DatasetCreateResponse | null>
onDeriveMapSelectionDataset: (bbox: VectorSelectionBBox, areaId?: string) => Promise<DatasetCreateResponse | null>
onSelectMapQaReferenceDataset: (datasetId: string) => void
onRunMapSelectionQa: (candidateDataset?: DatasetCreateResponse | null) => Promise<QaComparisonResult | null>
onOpenMapSelectionQualityEvidence: () => void
@@ -1123,7 +1123,7 @@ export function MapWorkspace({
setSelectionBbox(bbox)
setFirstSelectionCorner(null)
setBboxSelectionMode(false)
void analyzeSelection(bbox)
void analyzeSelection(bbox, selectedMapArea?.id)
}
const runAreaExtract = () => {
@@ -1131,7 +1131,7 @@ export function MapWorkspace({
if (!bbox) {
return
}
void analyzeSelection(bbox)
void analyzeSelection(bbox, selectedMapArea?.id)
}
const clearAreaSelection = () => {
@@ -1183,7 +1183,7 @@ export function MapWorkspace({
if (!bbox) {
return
}
onDeriveMapSelectionDataset(bbox)
onDeriveMapSelectionDataset(bbox, selectedMapArea?.id)
}
const openSelectedDatabaseLayer = (datasetId: string) => {
@@ -1251,8 +1251,7 @@ export function MapWorkspace({
if (!mapSelectionBbox || !earlierDatasetId || !laterDatasetId) {
return
}
const areaId = selectedAreaBbox && bboxesEqual(mapSelectionBbox, selectedAreaBbox) ? selectedMapAreaId : undefined
void compareTemporalSnapshots(earlierDatasetId, laterDatasetId, mapSelectionBbox, areaId)
void compareTemporalSnapshots(earlierDatasetId, laterDatasetId, mapSelectionBbox, selectedMapArea?.id)
}
const handleMapBboxPreview = (bbox: VectorSelectionBBox) => {
@@ -1262,7 +1261,7 @@ export function MapWorkspace({
const handleMapBboxSelect = (bbox: VectorSelectionBBox) => {
setFirstSelectionCorner(null)
setBboxSelectionMode(false)
void analyzeSelection(bbox)
void analyzeSelection(bbox, selectedMapArea?.id)
}
const runQuickAoiExtract = () => {
@@ -1271,7 +1270,7 @@ export function MapWorkspace({
return
}
setSelectionBbox(bbox)
void analyzeSelection(bbox, selectedAreaBbox ? selectedMapArea?.id : undefined)
void analyzeSelection(bbox, selectedMapArea?.id)
}
const runFullGisWorkflow = async () => {
@@ -1310,7 +1309,7 @@ export function MapWorkspace({
try {
setFullWorkflowStatus('1/4 Querying persisted vector_features...')
setSelectionBbox(bbox)
const selection = await onRunMapSelectionExtract(bbox)
const selection = await onRunMapSelectionExtract(bbox, selectedMapArea?.id)
if (!selection) {
setFullWorkflowError('Persisted vector query did not complete.')
setFullWorkflowStatus('Stopped at query.')
@@ -1318,7 +1317,7 @@ export function MapWorkspace({
}
setFullWorkflowStatus('2/4 Saving derived result dataset...')
const derived = await onDeriveMapSelectionDataset(bbox)
const derived = await onDeriveMapSelectionDataset(bbox, selectedMapArea?.id)
if (!derived) {
setFullWorkflowError('Derived result dataset was not created.')
setFullWorkflowStatus('Stopped at dataset save.')
+2 -1
View File
@@ -24,7 +24,7 @@ export function useMapSelectionDataset({
const [selectionDatasetError, setSelectionDatasetError] = useState<string | null>(null)
const [latestSelectionDataset, setLatestSelectionDataset] = useState<DatasetCreateResponse | null>(null)
const deriveMapSelectionDataset = async (bbox: VectorSelectionBBox) => {
const deriveMapSelectionDataset = async (bbox: VectorSelectionBBox, areaId?: string) => {
if (!selectedProjectId || !selectedDataset || !isVectorDatasetType(selectedDataset.dataset_type)) {
setSelectionDatasetError('Select a vector dataset before saving the area as a dataset.')
return null
@@ -34,6 +34,7 @@ export function useMapSelectionDataset({
try {
const derived = await datasetsApi.deriveVectorSelection(selectedProjectId, selectedDataset.id, {
bbox: { ...bbox, crs: 'EPSG:4326' },
area_id: areaId,
limit: 250,
output_name: `${selectedDataset.name.replace(/\.(geo)?json$/i, '')}-selection-dataset`,
})