Skip to content

Commit af58ed2

Browse files
committed
#71 #114 #268 added TODO notes on deprecation of GeometryCollection
1 parent 69bce92 commit af58ed2

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

openeo_driver/ProcessGraphDeserializer.py

+1
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,7 @@ def filter_spatial(args: Dict, env: EvalEnv) -> DriverDataCube:
12751275
)
12761276

12771277
if isinstance(geometries, dict):
1278+
# TODO #71 #114 #268 EP-3981 avoid GeometryCollection and standardize on vector cubes
12781279
geometries = geojson_to_geometry(geometries)
12791280
if isinstance(geometries, GeometryCollection):
12801281
polygons = [

openeo_driver/datacube.py

+3
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,9 @@ def write_assets(
578578
return {p.name: {"href": p} for p in components}
579579

580580
def to_multipolygon(self) -> shapely.geometry.MultiPolygon:
581+
# TODO: be more strict about point handling: current implementation:
582+
# if all items are points, a MultiPoint will be returned
583+
# if it is a mix of points and polygons, it will return a (Multi)Polygon, ignoring the points.
581584
return shapely.ops.unary_union(self._geometries.geometry)
582585

583586
def to_legacy_save_result(self) -> Union["AggregatePolygonResult", "JSONResult"]:

openeo_driver/util/geometry.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ def _validate_feature_collection(geojson):
140140

141141
def geojson_to_geometry(geojson: dict) -> BaseGeometry:
142142
"""Convert GeoJSON object to shapely geometry object"""
143-
# TODO #71 #114 EP-3981 standardize on using (FeatureCollection like) vector cubes instead of GeometryCollection?
143+
# TODO #71 #114 EP-3981 standardize on vector cubes instead of deprecated GeometryCollection?
144+
_log.warning("geojson_to_geometry usage is deprecated and should be replaced by proper vector cube usage")
144145
validate_geojson_coordinates(geojson)
145146
if geojson["type"] == "FeatureCollection":
146147
geojson = {

0 commit comments

Comments
 (0)