Skip to content

Commit 43b6b3e

Browse files
author
Sonja Stockhaus
committed
handle empty points in the image
1 parent 267922a commit 43b6b3e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/spatialdata_plot/pl/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,13 @@ def get_point_bb(
314314

315315
# Split by Point and Polygon:
316316
tmp_points = sdata.shapes[e_id][
317-
sdata.shapes[e_id]["geometry"].apply(lambda geom: geom.geom_type == "Point")
317+
sdata.shapes[e_id]["geometry"].apply(
318+
lambda geom: (geom.geom_type == "Point" and not geom.is_empty)
319+
)
318320
]
319321
tmp_polygons = sdata.shapes[e_id][
320322
sdata.shapes[e_id]["geometry"].apply(
321-
lambda geom: geom.geom_type in ["Polygon", "MultiPolygon"]
323+
lambda geom: (geom.geom_type in ["Polygon", "MultiPolygon"] and not geom.is_empty)
322324
)
323325
]
324326

0 commit comments

Comments
 (0)