Skip to content

Commit ce91ba2

Browse files
authored
BUG: fix corner case of empty intersection in streetscape (#674)
1 parent ecdc560 commit ce91ba2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

momepy/streetscape.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -900,12 +900,12 @@ def _compute_sigthlines_plot_indicators_one_side(
900900
match_geom = None
901901

902902
if not gdf_items.empty:
903-
_distances = gdf_items.exterior.intersection(
904-
sightline_geom
905-
).distance(s_pt1)
906-
match_id = _distances.idxmin()
907-
match_distance = _distances.min()
908-
match_geom = gdf_items.geometry[match_id]
903+
intersection = gdf_items.exterior.intersection(sightline_geom)
904+
if not intersection.is_empty.all():
905+
_distances = intersection.distance(s_pt1)
906+
match_id = _distances.idxmin()
907+
match_distance = _distances.min()
908+
match_geom = gdf_items.geometry[match_id]
909909

910910
parcel_ids = []
911911
# ---------------

0 commit comments

Comments
 (0)