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.

Hornbydd
44.9k5 gold badges42 silver badges84 bronze badges
asked Jul 7, 2016 at 16:43
2
  • Can you build the array iteratively and write all at once at the end? 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. Commented Jul 11, 2016 at 0:37

1 Answer 1

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)
answered Jul 11, 2016 at 0:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.