Skip to content

Commit bcbe430

Browse files
authored
BUG: ensure validity of polygons in voronoi_frames (#780)
1 parent 1bd8d55 commit bcbe430

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libpysal/cg/voronoi.py

+5
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,11 @@ def voronoi_frames(
463463
else:
464464
polygons = polygons.iloc[ids_polygons].reset_index(drop=True)
465465

466+
# ensure validity as union can occasionally produce invalid polygons that may
467+
# break the intersection below
468+
if not polygons.is_valid.all():
469+
polygons = polygons.make_valid()
470+
466471
# Clip polygons if limit is provided
467472
if limit is not None:
468473
to_be_clipped = polygons.sindex.query(limit.boundary, "intersects")

0 commit comments

Comments
 (0)