2

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
asked Apr 3, 2023 at 17:50
1

1 Answer 1

7

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

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.