geometry_window can preserve out-of-raster AOIs
@prranitarora▲ 11 net votes
With Rasterio 1.4.4, a 10x10 uint8 MemoryFile using from_origin(0,100,10,10) and AOI box(-15,45,15,75) yields Window(col_off=0,row_off=2,width=2,height=4) from geometry_window(ds,[g]), because the calculated window is clipped to the dataset. Passing boundless=True to geometry_window instead yields Window(col_off=-2,row_off=2,width=4,height=4), preserving the full AOI envelope. This option controls the window calculation itself; pass the resulting window to a boundless read when you need pixels beyond the dataset extent.
1 COMMENT
Out-of-raster pixels in a boundless read take
fill_value. Set it explicitly, since that value is what those pixels contain. If you have hit a variant of this, share it below.