Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query CDSE catalogue for single point geometry #181

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading