Constrain selections to active work areas
This commit is contained in:
@@ -111,6 +111,13 @@ class TemporalAnalysisService:
|
||||
|
||||
bbox = payload.bbox.model_dump()
|
||||
selection_area = TemporalAnalysisService._get_selection_area(db, project_id, payload.area_id)
|
||||
selection_geometry = None
|
||||
selection_covers_full_area = False
|
||||
if selection_area is not None:
|
||||
selection_geometry, selection_covers_full_area = VectorFeatureService.constrain_bbox_to_area(
|
||||
bbox,
|
||||
selection_area.geometry,
|
||||
)
|
||||
summaries: dict[UUID, dict[str, Any]] = {}
|
||||
|
||||
def summarize(dataset: Dataset) -> dict[str, Any]:
|
||||
@@ -119,10 +126,13 @@ class TemporalAnalysisService:
|
||||
return cached
|
||||
kwargs: dict[str, Any] = {"dataset": dataset, "bbox": bbox}
|
||||
if selection_area is not None:
|
||||
kwargs["selection_geometry"] = selection_area.geometry
|
||||
kwargs["full_dataset_area"] = VectorFeatureService.can_use_full_area_fast_path(
|
||||
dataset,
|
||||
selection_area.id,
|
||||
kwargs["selection_geometry"] = selection_geometry
|
||||
kwargs["full_dataset_area"] = (
|
||||
selection_covers_full_area
|
||||
and VectorFeatureService.can_use_full_area_fast_path(
|
||||
dataset,
|
||||
selection_area.id,
|
||||
)
|
||||
)
|
||||
summary = VectorFeatureService.summarize_features_by_bbox(db, **kwargs)
|
||||
summaries[dataset.id] = summary
|
||||
@@ -154,14 +164,16 @@ class TemporalAnalysisService:
|
||||
later=later,
|
||||
bbox=bbox,
|
||||
preview_limit=payload.preview_limit,
|
||||
selection_geometry=selection_area.geometry if selection_area is not None else None,
|
||||
selection_geometry=selection_geometry,
|
||||
earlier_full_dataset_area=(
|
||||
VectorFeatureService.can_use_full_area_fast_path(earlier, selection_area.id)
|
||||
selection_covers_full_area
|
||||
and VectorFeatureService.can_use_full_area_fast_path(earlier, selection_area.id)
|
||||
if selection_area is not None
|
||||
else False
|
||||
),
|
||||
later_full_dataset_area=(
|
||||
VectorFeatureService.can_use_full_area_fast_path(later, selection_area.id)
|
||||
selection_covers_full_area
|
||||
and VectorFeatureService.can_use_full_area_fast_path(later, selection_area.id)
|
||||
if selection_area is not None
|
||||
else False
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user