Is there a way to add data to a GEOTiff file in a loop? I can make one using WriteArray like so:


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
    Commented 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
    Commented 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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.