0

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 Jul 7 '16 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 Jul 11 '16 at 0:37
2

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, privacy policy and cookie policy

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