Skip to content

Commit

Permalink
Bug fix for getting the bounds of a geojson.FeatureCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentVerelst committed Jun 19, 2024
1 parent eaac70e commit 6d24539
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/openeo_gfmap/utils/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from rasterio.warp import transform_bounds
from shapely import unary_union
from shapely.geometry import box, shape
from shapely.ops import unary_union

from openeo_gfmap import (
Backend,
Expand Down Expand Up @@ -131,9 +132,11 @@ def s1_area_per_orbitstate(
Keys containing the orbit state and values containing the total area of intersection in
km^2
"""
if isinstance(spatial_extent, GeoJSON):
if isinstance(spatial_extent, geojson.FeatureCollection):
# Transform geojson into shapely geometry and compute bounds
bounds = shape(spatial_extent).bounds
shapely_geometries = [shape(feature['geometry']) for feature in spatial_extent['features']]
geometry = unary_union(shapely_geometries)
bounds = geometry.bounds
epsg = 4362
elif isinstance(spatial_extent, BoundingBoxExtent):
bounds = [
Expand Down

0 comments on commit 6d24539

Please sign in to comment.