<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>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><br>
    </p>
    <div class="moz-cite-prefix">Le 20/04/2021 à 21:37, ni hao a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:DM5PR02MB386258F2E9A856FC277BF1F0F1489@DM5PR02MB3862.namprd02.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <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="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>From:</b> Even
          Rouault <a class="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="moz-txt-link-rfc2396E" href="mailto:ni_hao88@hotmail.com"><ni_hao88@hotmail.com></a>;
          <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a> <a class="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><br>
        </p>
        <div class="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" moz-do-not-send="true">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><span>ds =
            gdal.GetDriverByName('GTiff').Create(output_magnitude,
            xsize, ysize, 1, gdal.GDT_Float32, options=['BIGTIFF=YES'])</span></p>
        <p><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><br>
        </p>
        <blockquote type="cite">
          <div><span>but it didn't work.</span></div>
          <div><span><br>
            </span></div>
          <br>
          <fieldset class="x_mimeAttachmentHeader"></fieldset>
          <pre class="x_moz-quote-pre">_______________________________________________
gdal-dev mailing list
<a class="x_moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>
<a class="x_moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
        </blockquote>
        <pre class="x_moz-signature" cols="72">-- 
<a class="x_moz-txt-link-freetext" href="http://www.spatialys.com" moz-do-not-send="true">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>