@@ -572,9 +572,7 @@ def partitionByKey(spatialkey):
572
572
def chunk_polygon (
573
573
self ,
574
574
reducer : Union [ProcessGraphVisitor , Dict ],
575
- # TODO: it's wrong to use MultiPolygon as a collection of polygons. MultiPolygons should be handled as single, atomic "features"
576
- # also see https://github.com/Open-EO/openeo-python-driver/issues/288
577
- chunks : MultiPolygon ,
575
+ chunks : DriverVectorCube ,
578
576
mask_value : float ,
579
577
env : EvalEnv ,
580
578
context : Optional [dict ] = None ,
@@ -584,27 +582,20 @@ def chunk_polygon(
584
582
585
583
if isinstance (reducer , dict ):
586
584
reducer = GeoPySparkBackendImplementation .accept_process_graph (reducer )
587
- chunks : List [Polygon ] = chunks .geoms
588
585
jvm = get_jvm ()
589
586
590
587
result_collection = None
591
588
if isinstance (reducer , SingleNodeUDFProcessGraphVisitor ):
592
589
udf , udf_context = self ._extract_udf_code_and_context (process = reducer , context = context , env = env )
593
- # Polygons should use the same projection as the rdd.
594
- # TODO Usage of GeometryCollection should be avoided. It's abused here like a FeatureCollection,
595
- # but a GeometryCollections is conceptually just single "feature".
596
- # What you want here is proper support for FeatureCollections or at least a list of individual geometries.
597
- # also see https://github.com/Open-EO/openeo-python-driver/issues/71, https://github.com/Open-EO/openeo-python-driver/issues/288
598
590
reprojected_polygons : jvm .org .openeo .geotrellis .ProjectedPolygons \
599
- = to_projected_polygons (jvm , GeometryCollection ( chunks ) )
591
+ = to_projected_polygons (jvm , chunks )
600
592
band_names = self .metadata .band_dimension .band_names
601
593
602
594
def rdd_function (rdd , _zoom ):
603
595
return jvm .org .openeo .geotrellis .udf .Udf .runChunkPolygonUserCode (
604
596
udf , rdd , reprojected_polygons , band_names , udf_context , mask_value
605
597
)
606
598
607
- # All JEP implementation work with float cell types.
608
599
float_cube = self .apply_to_levels (lambda layer : self ._convert_celltype (layer , "float32" ))
609
600
result_collection = float_cube ._apply_to_levels_geotrellis_rdd (
610
601
rdd_function , self .metadata , gps .LayerType .SPACETIME
0 commit comments