Discussion:
[gdal-dev] Python create BigTIFF image
ni hao
2021-04-20 18:53:23 UTC
Permalink
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)
but it didn't work.
Even Rouault
2021-04-20 18:56:53 UTC
Permalink
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
> <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-***@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

--
http://www.spatialys.com
My software is free, but my time generally not.
ni hao
2021-04-20 19:37:24 UTC
Permalink
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 <***@spatialys.com>
Sent: April 20, 2021 3:56 PM
To: ni hao <***@hotmail.com>; gdal-***@lists.osgeo.org <gdal-***@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-***@lists.osgeo.org<mailto:gdal-***@lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
http://www.spatialys.com
My software is free, but my time generally not.
Javier Jimenez Shaw
2021-04-20 19:41:44 UTC
Permalink
I don't think so. Bigtiff is a creation option, that defines the format of
the file.

ni hao <***@hotmail.com> schrieb am Di., 20. Apr. 2021, 21:37:

> 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 <***@spatialys.com>
> *Sent:* April 20, 2021 3:56 PM
> *To:* ni hao <***@hotmail.com>; gdal-***@lists.osgeo.org <
> gdal-***@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 listgdal-***@lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-***@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
Even Rouault
2021-04-20 20:03:30 UTC
Permalink
Ah ok that explains it then. The heuristics in the Create() method only
takes into account the full resolution image, not potential overviews
you might add. So you have to go with the explict option =
['BIGTIFF=YES'] argument I suggested


Le 20/04/2021 à 21:37, ni hao a écrit :
> 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 <***@spatialys.com>
> *Sent:* April 20, 2021 3:56 PM
> *To:* ni hao <***@hotmail.com>; gdal-***@lists.osgeo.org
> <gdal-***@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
>> <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-***@lists.osgeo.org <mailto:gdal-***@lists.osgeo.org>
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev <https://lists.osgeo.org/mailman/listinfo/gdal-dev>
> --
> http://www.spatialys.com <http://www.spatialys.com>
> My software is free, but my time generally not.

--
http://www.spatialys.com
My software is free, but my time generally not.
ni hao
2021-04-20 20:10:01 UTC
Permalink
Thank you Even and Javier for your help.
GDAL list is great!!



________________________________
From: Even Rouault <***@spatialys.com>
Sent: April 20, 2021 5:03 PM
To: ni hao <***@hotmail.com>; gdal-***@lists.osgeo.org <gdal-***@lists.osgeo.org>
Subject: Re: [gdal-dev] Python create BigTIFF image


Ah ok that explains it then. The heuristics in the Create() method only takes into account the full resolution image, not potential overviews you might add. So you have to go with the explict option = ['BIGTIFF=YES'] argument I suggested


Le 20/04/2021 à 21:37, ni hao a écrit :
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 <***@spatialys.com><mailto:***@spatialys.com>
Sent: April 20, 2021 3:56 PM
To: ni hao <***@hotmail.com><mailto:***@hotmail.com>; gdal-***@lists.osgeo.org<mailto:gdal-***@lists.osgeo.org> <gdal-***@lists.osgeo.org><mailto:gdal-***@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-***@lists.osgeo.org<mailto:gdal-***@lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
http://www.spatialys.com
My software is free, but my time generally not.

--
http://www.spatialys.com
My software is free, but my time generally not.
Loading...