How can I specify compression in Python Gdal.Grid? Currently, I do not see an option to specify compression while performing gdal.Grid
operation.
gdal.Grid(output_raster_path, geodata,
zfield=field,
algorithm="linear",
outputBounds=[ulx, uly, lrx, lry],
width=xsize, height=ysize)
To perform compression, I'm currently calling gdal translate on the result of gdal.Grid
operation.
ds = gdal.Translate(output_file, input_file, creationOptions=["COMPRESS=LZW", "TILED=YES"])
ds = None
Vince
20.5k16 gold badges49 silver badges65 bronze badges
1 Answer 1
Just like gdal.Translate
, gdal.Grid
accepts creationOptions:
gdal.Grid(output_raster_path, geodata,
zfield=field,
algorithm="linear",
outputBounds=[ulx, uly, lrx, lry],
width=xsize, height=ysize,
creationOptions=["COMPRESS=LZW", "TILED=YES"])
answered Apr 3, 2023 at 23:52
lang-py
creationOptions
kwarg, just like you're doing withgdal.Translate
. Is that not working?