From 45e09bcf2c92ccb84bd2c7e1be681d02b1e41210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Bati=C4=8D?= Date: Mon, 21 Oct 2024 13:16:25 +0200 Subject: [PATCH] Fix for is_empty vs non-empty area. --- sentinelhub/areas.py | 2 +- tests/test_areas.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sentinelhub/areas.py b/sentinelhub/areas.py index baff3349..bf9f3caf 100644 --- a/sentinelhub/areas.py +++ b/sentinelhub/areas.py @@ -534,7 +534,7 @@ def _make_split(self) -> tuple[list[BBox], list[dict[str, object]]]: geo_object for geo_object in intersection if isinstance(geo_object, (Polygon, MultiPolygon)) ) - if not intersection.is_empty: + if intersection.area > 0: intersection = Geometry(intersection, CRS.WGS84).transform(utm_crs) bbox_partition = self._align_bbox_to_size(intersection.bbox).get_partition(size_x=size_x, size_y=size_y) diff --git a/tests/test_areas.py b/tests/test_areas.py index 7934e7f7..fe8f22d7 100644 --- a/tests/test_areas.py +++ b/tests/test_areas.py @@ -46,6 +46,7 @@ (UtmGridSplitter, ([AREA], CRS.WGS84), dict(bbox_size=(1200, 1200)), 16), (UtmZoneSplitter, ([AREA], CRS.WGS84), dict(bbox_size=(1000, 1000)), 19), (UtmZoneSplitter, ([AREA], CRS.WGS84), dict(bbox_size=(1000, 1000), offset=(500, 500)), 21), + (UtmZoneSplitter, ([shapely.box(0, 0, 1, 1)], CRS.WGS84), dict(bbox_size=(10000, 10000)), 144), pytest.param( TileSplitter, ([AREA], CRS.WGS84, ("2017-10-01", "2018-03-01")),