# Writing large DiskArrays to geotiff using ArchGDAL

**URL:** <https://discourse.julialang.org/t/writing-large-diskarrays-to-geotiff-using-archgdal/80709>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [May 8, 2022, 12:45pm UTC](https://discourse.julialang.org/t/writing-large-diskarrays-to-geotiff-using-archgdal/80709 "2022-05-08T12:45:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunayana](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sunayana](https://discourse.julialang.org/u/sunayana)\
**Post date:** [May 8, 2022, 12:45pm UTC](https://discourse.julialang.org/t/writing-large-diskarrays-to-geotiff-using-archgdal/80709/1 "2022-05-08T12:45:05Z")

</div>

Hi,  
I have a large 2D DiskArrays.BroadDiskArray which I want to write to a Geotiff file without a huge memory overhead. But I do not see a memory efficient way of doing this`DiskArrays.BroadcastDiskArray`:

So this is how far I got :

```julia
function save_array(
    out_path::String,
    array::DiskArrays.BroadcastDiskArray,
    src_dataset::AG.IDataset,
)
    (m, n) = size(array)
    gds_out = AG.create(
        out_path,
        driver = AG.getdriver("GTiff"),
        width = m,
        height = n,
        nbands = 1,
        options = ["COMPRESS=DEFLATE"],
        dtype = Int32,
    )

    AG.setgeotransform!(gds_out, AG.getgeotransform(src_dataset))
    AG.setproj!(gds_out, AG.getproj(src_dataset))

    AG.write!(gds_out, array[:, :], 1)
   AG.destroy(gds_out)
end

```

Is there a way to do a window write of the whole array to the dataset without too many memory allocations?

Thanks!

---

<div class="post-metadata">

**Author:** ![sunayana](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sunayana](https://discourse.julialang.org/u/sunayana)\
**Post date:** [May 10, 2022, 8:22am UTC](https://discourse.julialang.org/t/writing-large-diskarrays-to-geotiff-using-archgdal/80709/2 "2022-05-10T08:22:01Z")

</div>

I was able to solve this issue by looking into the ArchGDAL tests on github there are plenty of examples there.
