diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b3cdb3..35b5d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed ### Fixed +Fixed bug where `s1_area_per_orbitstate_vvvh` failed for FeatureCollections containing a single point ## [0.2.0] - 2024-10-10 diff --git a/src/openeo_gfmap/utils/catalogue.py b/src/openeo_gfmap/utils/catalogue.py index 70757b6..acf5198 100644 --- a/src/openeo_gfmap/utils/catalogue.py +++ b/src/openeo_gfmap/utils/catalogue.py @@ -8,7 +8,7 @@ from pyproj.crs import CRS from rasterio.warp import transform_bounds from requests import adapters -from shapely.geometry import box, shape +from shapely.geometry import Point, box, shape from shapely.ops import unary_union from openeo_gfmap import ( @@ -204,8 +204,14 @@ def s1_area_per_orbitstate_vvvh( shapely_geometries = [ shape(feature["geometry"]) for feature in spatial_extent["features"] ] - geometry = unary_union(shapely_geometries) - bounds = geometry.bounds + if len(shapely_geometries) == 1 and isinstance(shapely_geometries[0], Point): + point = shapely_geometries[0] + buffer_size = 0.0001 + buffered_geometry = point.buffer(buffer_size) + bounds = buffered_geometry.bounds + else: + geometry = unary_union(shapely_geometries) + bounds = geometry.bounds epsg = 4326 elif isinstance(spatial_extent, BoundingBoxExtent): bounds = [