diff --git a/openeo_driver/ProcessGraphDeserializer.py b/openeo_driver/ProcessGraphDeserializer.py index 873c56c2..5f603d73 100644 --- a/openeo_driver/ProcessGraphDeserializer.py +++ b/openeo_driver/ProcessGraphDeserializer.py @@ -1275,6 +1275,7 @@ def filter_spatial(args: Dict, env: EvalEnv) -> DriverDataCube: ) if isinstance(geometries, dict): + # TODO #71 #114 #268 EP-3981 avoid GeometryCollection and standardize on vector cubes geometries = geojson_to_geometry(geometries) if isinstance(geometries, GeometryCollection): polygons = [ diff --git a/openeo_driver/datacube.py b/openeo_driver/datacube.py index 9fe41373..2371a174 100644 --- a/openeo_driver/datacube.py +++ b/openeo_driver/datacube.py @@ -578,6 +578,9 @@ def write_assets( return {p.name: {"href": p} for p in components} def to_multipolygon(self) -> shapely.geometry.MultiPolygon: + # TODO: be more strict about point handling: current implementation: + # if all items are points, a MultiPoint will be returned + # if it is a mix of points and polygons, it will return a (Multi)Polygon, ignoring the points. return shapely.ops.unary_union(self._geometries.geometry) def to_legacy_save_result(self) -> Union["AggregatePolygonResult", "JSONResult"]: diff --git a/openeo_driver/util/geometry.py b/openeo_driver/util/geometry.py index dfcf05bb..3f373eeb 100644 --- a/openeo_driver/util/geometry.py +++ b/openeo_driver/util/geometry.py @@ -140,7 +140,8 @@ def _validate_feature_collection(geojson): def geojson_to_geometry(geojson: dict) -> BaseGeometry: """Convert GeoJSON object to shapely geometry object""" - # TODO #71 #114 EP-3981 standardize on using (FeatureCollection like) vector cubes instead of GeometryCollection? + # TODO #71 #114 EP-3981 standardize on vector cubes instead of deprecated GeometryCollection? + _log.warning("geojson_to_geometry usage is deprecated and should be replaced by proper vector cube usage") validate_geojson_coordinates(geojson) if geojson["type"] == "FeatureCollection": geojson = {