Skip to content

Commit

Permalink
Issue #114/#141/#239 re-enable automatic vector cube conversion for P…
Browse files Browse the repository at this point in the history
…oint geometries in aggregate_spatial

reverts 2ec255e and 4927eee
openeo-geopyspark-driver now properly supports point geometries
  • Loading branch information
soxofaan committed Oct 18, 2022
1 parent e1e35f5 commit 4400565
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
20 changes: 2 additions & 18 deletions openeo_driver/ProcessGraphDeserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,24 +1052,8 @@ def aggregate_spatial(args: dict, env: EvalEnv) -> DriverDataCube:
geoms = geoms
elif isinstance(geoms, dict):
try:
if (
# Don't convert point geometries to DriverVectorCube
# TODO #114 migrate Point handling to DriverVectorCube too
geoms["type"] == "Point"
or (geoms["type"] == "Feature" and geoms["geometry"]["type"] == "Point")
or (
geoms["type"] == "FeatureCollection"
and any(f["geometry"]["type"] == "Point" for f in geoms["features"])
)
or (
geoms["type"] == "GeometryCollection"
and any(g["type"] == "Point" for g in geoms["geometries"])
)
):
geoms = geojson_to_geometry(geoms)
else:
# Automatically convert inline GeoJSON to a vector cube #114/#141
geoms = env.backend_implementation.vector_cube_cls.from_geojson(geoms)
# Automatically convert inline GeoJSON to a vector cube #114/#141
geoms = env.backend_implementation.vector_cube_cls.from_geojson(geoms)
except Exception as e:
_log.error(
f"Failed to parse inline GeoJSON geometries in aggregate_spatial: {e!r}",
Expand Down
2 changes: 1 addition & 1 deletion openeo_driver/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.21.5a1"
__version__ = "0.21.6a1"
1 change: 1 addition & 0 deletions openeo_driver/dry_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ def aggregate_spatial(
cube = self.filter_bbox(**bbox, operation="_weak_spatial_extent")
cube._process(operation="aggregate_spatial", arguments={"geometries": geometries})
if isinstance(geometries, (Polygon, MultiPolygon)):
# TODO #71 normalize to feature collection instead of deprecated geometry collection
geometries = GeometryCollection([geometries])
return AggregatePolygonResult(timeseries={}, regions=geometries)

Expand Down

0 comments on commit 4400565

Please sign in to comment.