satellogic / telluric

telluric is a Python library to manage vector and raster geospatial data in an interactive and easy way
MIT License
87 stars 18 forks source link

Filter footprints before merge_all #296

Closed marcronq closed 3 years ago

marcronq commented 3 years ago

There is a corner case not covered in georaster.merge_all():

Imagine you have some rasters you want to merge and crop by a ROI. One of the rasters is very close to the polygon, overlapping it or not, by less than the target resolution. In some cases, the footprints intersect but the result of the crop yields a raster with 0 height or width, which raises an exception in the next _reproject call (inside georaster._prepare_other_raster function).

This PR checks if tmp cropped image has 0 width or height and discards it if it does, allowing you to merge using the rest of the valid images.