[gdal-dev] Python create BigTIFF image

ni hao ni_hao88 at hotmail.com
Tue Apr 20 12:37:24 PDT 2021


Even,

Thank you for your reply.
You are right: ds = gdal.GetDriverByName('GTiff').Create( ) is under 4GB.
It was the next command pushes GTiff over 4GB:
  ds.BuildOverviews('AVERAGE_MAGPHASE', [2,4,8,16])

Is there a way to specify BIGTIFF in ds.BuildOverviews() ?

________________________________
From: Even Rouault <even.rouault at spatialys.com>
Sent: April 20, 2021 3:56 PM
To: ni hao <ni_hao88 at hotmail.com>; gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
Subject: Re: [gdal-dev] Python create BigTIFF image



Le 20/04/2021 à 20:53, ni hao a écrit :
Hi list,

I use Python to create GeoTiff image, and I get the error because it exceeds 4GB.
ds = gdal.GetDriverByName('GTiff').Create(output_magnitude, xsize, ysize, 1, gdal.GDT_Float32)

   ERROR 1: TIFFReadDirectory:Failed to read directory at offset 4294957836
   ERROR 1: TIFFWriteDirectoryTagData:Maximum TIFF file size exceeded. Use BIGTIFF=YES creation option.

I need to turn on BIGTIFF=YES
https://gdal.org/drivers/raster/gtiff.html

But I don't do know how. I tried:
ds = gdal.GetDriverByName('GTiff').Create(output_magnitude, xsize, ysize, 1, gdal.GDT_Float32, BIGTIFF=YES)

ds = gdal.GetDriverByName('GTiff').Create(output_magnitude, xsize, ysize, 1, gdal.GDT_Float32, options=['BIGTIFF=YES'])

But as you didn't specify compression, it should have done that automatically. Can you indicate the exact values of xsize and ysize you use ?


but it didn't work.




_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210420/128e743c/attachment.html>


More information about the gdal-dev mailing list