Skip to content

Commit

Permalink
handle empty points in the image
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonja Stockhaus committed Aug 3, 2023
1 parent 267922a commit 43b6b3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/spatialdata_plot/pl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,13 @@ def get_point_bb(

# Split by Point and Polygon:
tmp_points = sdata.shapes[e_id][
sdata.shapes[e_id]["geometry"].apply(lambda geom: geom.geom_type == "Point")
sdata.shapes[e_id]["geometry"].apply(
lambda geom: (geom.geom_type == "Point" and not geom.is_empty)
)
]
tmp_polygons = sdata.shapes[e_id][
sdata.shapes[e_id]["geometry"].apply(
lambda geom: geom.geom_type in ["Polygon", "MultiPolygon"]
lambda geom: (geom.geom_type in ["Polygon", "MultiPolygon"] and not geom.is_empty)
)
]

Expand Down

0 comments on commit 43b6b3e

Please sign in to comment.