<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you Even and Javier for your help.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
GDAL list is great!!</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Even Rouault <even.rouault@spatialys.com><br>
<b>Sent:</b> April 20, 2021 5:03 PM<br>
<b>To:</b> ni hao <ni_hao88@hotmail.com>; gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org><br>
<b>Subject:</b> Re: [gdal-dev] Python create BigTIFF image</font>
<div> </div>
</div>
<div>
<p style="margin-top: 0px; margin-bottom: 0px;">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<br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;"><br>
</p>
<div class="x_moz-cite-prefix">Le 20/04/2021 à 21:37, ni hao a écrit :<br>
</div>
<blockquote type="cite">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Even,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span id="" title="" class="">Thank you</span> for your reply.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
You are right: ds = gdal.GetDriverByName('GTiff').Create( ) is under 4GB.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
It was the next command pushes GTiff over 4GB:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
ds.BuildOverviews('AVERAGE_MAGPHASE', [2,4,8,16]) </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Is there a way to specify BIGTIFF in ds.<span style="background-color:rgb(255,255,255); display:inline!important">BuildOverviews() ?</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Even Rouault
<a class="x_moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a><br>
<b>Sent:</b> April 20, 2021 3:56 PM<br>
<b>To:</b> ni hao <a class="x_moz-txt-link-rfc2396E" href="mailto:ni_hao88@hotmail.com">
<ni_hao88@hotmail.com></a>; <a class="x_moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">
gdal-dev@lists.osgeo.org</a> <a class="x_moz-txt-link-rfc2396E" href="mailto:gdal-dev@lists.osgeo.org">
<gdal-dev@lists.osgeo.org></a><br>
<b>Subject:</b> Re: [gdal-dev] Python create BigTIFF image</font>
<div> </div>
</div>
<div>
<p style="margin-top: 0px; margin-bottom: 0px;"><br>
</p>
<div class="x_x_moz-cite-prefix">Le 20/04/2021 à 20:53, ni hao a écrit :<br>
</div>
<blockquote type="cite">
<div>Hi list,</div>
<div><br>
</div>
<div>I use Python to create GeoTiff image, and I get the error because it exceeds 4GB.</div>
<div>ds = gdal.GetDriverByName('GTiff').Create(output_magnitude, xsize, ysize, 1, gdal.GDT_Float32)<br>
</div>
<div><br>
</div>
<div><span><span><span> ERROR 1: TIFFReadDirectory:Failed to read directory at offset 4294957836</span></span></span><br>
<span><span><span> ERROR 1: TIFFWriteDirectoryTagData:Maximum TIFF file size exceeded. Use BIGTIFF=YES creation option.</span></span></span><br>
</div>
<div><br>
</div>
<div>I need to turn on <strong>BIGTIFF=YES</strong></div>
<div><a href="https://gdal.org/drivers/raster/gtiff.html" id="LPlnk">https://gdal.org/drivers/raster/gtiff.html</a><br>
</div>
<div><br>
</div>
<div>But I don't do know how. I tried: </div>
<div><span>ds = gdal.GetDriverByName('GTiff').Create(output_magnitude, xsize, ysize, 1, gdal.GDT_Float32, BIGTIFF=YES)</span><br>
</div>
</blockquote>
<p style="margin-top: 0px; margin-bottom: 0px;"><span>ds = gdal.GetDriverByName('GTiff').Create(output_magnitude, xsize, ysize, 1, gdal.GDT_Float32, options=['BIGTIFF=YES'])</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;"><span>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 ?<br>
</span></p>
<p style="margin-top: 0px; margin-bottom: 0px;"><br>
</p>
<blockquote type="cite">
<div><span>but it didn't work.</span></div>
<div><span><br>
</span></div>
<br>
<fieldset class="x_x_mimeAttachmentHeader"></fieldset>
<pre class="x_x_moz-quote-pre">_______________________________________________
gdal-dev mailing list
<a class="x_x_moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="x_x_moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="x_x_moz-signature" cols="72">--
<a class="x_x_moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
</blockquote>
<pre class="x_moz-signature" cols="72">--
<a class="x_moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
</body>
</html>