Skip to content

Commit 6f6fa8b

Browse files
committed
Issue #287 More support for DriverVectorCube in apply_polygon
other refs: #288, d180c24
1 parent c95d1f1 commit 6f6fa8b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

openeo_driver/dry_run.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,12 @@ def chunk_polygon(
648648
self, reducer, chunks: MultiPolygon, mask_value: float, env: EvalEnv, context: Optional[dict] = None
649649
) -> "DryRunDataCube":
650650
# TODO #229: rename/update `chunk_polygon` to `apply_polygon` (https://github.com/Open-EO/openeo-processes/pull/298)
651-
polygons: List[Polygon] = chunks.geoms
651+
if isinstance(chunks, Polygon):
652+
polygons = [chunks]
653+
elif isinstance(chunks, MultiPolygon):
654+
polygons: List[Polygon] = chunks.geoms
655+
else:
656+
raise ValueError(f"Invalid type for `chunks`: {type(chunks)}")
652657
# TODO #71 #114 Deprecate/avoid usage of GeometryCollection
653658
geometries, bbox = self._normalize_geometry(GeometryCollection(polygons))
654659
cube = self.filter_bbox(**bbox, operation="weak_spatial_extent")

0 commit comments

Comments
 (0)