Padding rasterio windows


ashnair0007@...
 

I need to tile a large geotiff into equally sized tiles (with/without overlap depending on user). While I've been able to do that, a problem arises in the edge windows wherein the edge windows have a shorter length/width. I understand why this happens but I would like the edge windows to have the same size as well. 

One way to do this might be get all the edge windows, pad them and reproject them so that padding doesn't mess with the geo-referencing.  Is this an appropriate approach?


Luke
 
Edited

Have you tried keeping your windows all the same size (including the edge windows) and specifying `boundless=True` and a `fill_value=some appropriate value` to fill out your windows in your ` `dataset.read` call?

https://rasterio.readthedocs.io/en/latest/api/rasterio.io.html#rasterio.io.DatasetReader.read

i.e. (untested)

dataset.read(window=window, boundless=True, fill_value=dataset.nodata)


ashnair0007@...
 

Thanks. Setting the boundless flag fixed the problem.