You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Streetscape never matches the first building in the frame (building id 0 is falsy) #776
Streetscape never matches the first building in the buildings frame it is given, so every sightline that should stop at that building runs on to the next one (or to sightline_length and a gap).
Cause. In Streetscape.__init__ the buildings are numbered positionally:
so building id 0 reads as "no building" (both the left and right branches). Present on main (lines 198, 698, 717 of momepy/streetscape.py as of 84fd2a7) and in 1.0.0.
Minimal example (momepy 1.0.0, geopandas 1.1.3, shapely 2.1.2, Python 3.12):
The first building (box(0, 5, 30, 20), 5 m north of the street) is invisible: left_sb along x 0–30 is NaN instead of 5.0. Everything derived from the matches is affected for streets near that building (sb, os, h, hw, par_*, built_freq, the *_seq_sb_index lists).
Suggested fix. Test the match explicitly, e.g. if match_sl_building_id is not None: (the array is initialised with None), in both branches.
Workaround we use meanwhile: prepend a dummy building far outside every sightline's reach, with no height, so the real buildings are ids 1…n (and shift any lookup by those ids by one).
Activity
martinfleis commentedon Oct 13, 2026
Thanks, will fix!