nismod / snail

spatial networks impact assessment library 🐌
https://nismod.github.io/snail/
MIT License
9 stars 1 forks source link

Zero-length linestrings on edge of raster grid #50

Open thomas-fred opened 1 year ago

thomas-fred commented 1 year ago

Splitting sometimes returns zero-length linestrings on edge of raster

See below for example linestring on eastern (lon=70W) extent of box

(Pdb) geometry.coords.xy
(array('d', [-70.0, -70.0]), array('d', [18.445832920952196, 18.445832920952196]))

This split geometry has: j = raster_width However j should be in range: 0 <= j < raster_width As a hacky workaround, drop any splits with length 0

For more context to the above, see workflow/scripts/intersection.py in open-gira

Do we need a nudge off a cell boundary somewhere when performing the splits in snail?