Is there a way to add data to a GEOTiff file in a loop? I can make one using WriteArray like so:
dataset.GetRasterBand(1).WriteArray(array)
But whenever I put it in a for loop it just overwrites the data that was already there. I want to be able to append data to the existing data. The files this needs to work with can be too large to fit into memory so we can't do it in a single pass.
-
Can you build the array iteratively and write all at once at the end?J Kelly– J Kelly2016年07月07日 19:24:53 +00:00Commented Jul 7, 2016 at 19:24
-
See answer below, but if you want more detail, edit your question to provide a short code sample of what you are trying to achieve.user2856– user28562016年07月11日 00:37:26 +00:00Commented Jul 11, 2016 at 0:37
1 Answer 1
Personally, I've started using rasterio's windowed read/write
However, you can use x and y offsets when writing your array to the output dataset.
dataset.GetRasterBand(1).WriteArray(array, xoff, yoff)