Skip to content

Commit

Permalink
Merge pull request #181 from Open-EO/issue180-query-cdse-point
Browse files Browse the repository at this point in the history
Query CDSE catalogue for single point geometry
  • Loading branch information
VincentVerelst authored Nov 27, 2024
2 parents 5a318cc + 634bb8f commit 185dbec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 9 additions & 3 deletions src/openeo_gfmap/utils/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 = [
Expand Down

0 comments on commit 185dbec

Please sign in to comment.