Skip to content

Commit

Permalink
Fix for is_empty vs non-empty area.
Browse files Browse the repository at this point in the history
  • Loading branch information
batic committed Oct 21, 2024
1 parent 0ff5cc9 commit 45e09bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sentinelhub/areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/test_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down

0 comments on commit 45e09bc

Please sign in to comment.