From ce91ba265f67964ff9616f18c121e0e2b848523b Mon Sep 17 00:00:00 2001 From: Martin Fleischmann Date: Wed, 27 Nov 2024 22:27:02 +0100 Subject: [PATCH] BUG: fix corner case of empty intersection in streetscape (#674) --- momepy/streetscape.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/momepy/streetscape.py b/momepy/streetscape.py index 4cb9e342..8df25020 100644 --- a/momepy/streetscape.py +++ b/momepy/streetscape.py @@ -900,12 +900,12 @@ def _compute_sigthlines_plot_indicators_one_side( match_geom = None if not gdf_items.empty: - _distances = gdf_items.exterior.intersection( - sightline_geom - ).distance(s_pt1) - match_id = _distances.idxmin() - match_distance = _distances.min() - match_geom = gdf_items.geometry[match_id] + intersection = gdf_items.exterior.intersection(sightline_geom) + if not intersection.is_empty.all(): + _distances = intersection.distance(s_pt1) + match_id = _distances.idxmin() + match_distance = _distances.min() + match_geom = gdf_items.geometry[match_id] parcel_ids = [] # ---------------