Skip to content

Commit 4b7ce1a

Browse files
committed
Enhance raster output creation with BigTIFF support and compression options
1 parent 05cb100 commit 4b7ce1a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

stack_composed/stack_composed_main.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,17 @@ def run(stat, preproc, bands, nodata, output, output_type, num_process, chunksiz
218218
# create output raster
219219
driver = gdal.GetDriverByName('GTiff')
220220
nbands = 1
221+
222+
# Define creation options for BigTIFF, compression and tiling
223+
creation_options = [
224+
"BIGTIFF=YES", # Enable BigTIFF
225+
"COMPRESS=LZW", # Optional: Use LZW compression to reduce file size
226+
"TILED=YES" # Optional: Use tiled format for better performance with large files
227+
]
228+
221229
outRaster = driver.Create(output_filename, Image.wrapper_shape[1], Image.wrapper_shape[0],
222-
nbands, gdal_output_type)
230+
nbands, gdal_output_type, options=creation_options)
231+
223232
outband = outRaster.GetRasterBand(nbands)
224233

225234
# set the nodata to the output file

0 commit comments

Comments
 (0)