<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>No better with your .msk file. I don't think it is a usage issue.<br>
    </p>
    <p>You could likely create reproducers using gdal_create that will
      create a blank file with same dimension, band count, spatial
      information, etc.<br>
    </p>
    <p>gdal_create -if input.tif output.tif -co sparse_ok=yes -co
      tiled=yes<br>
    </p>
    <div class="moz-cite-prefix">Le 08/12/2021 à 19:24,
      <a class="moz-txt-link-abbreviated" href="mailto:Matt.Wilkie@yukon.ca">Matt.Wilkie@yukon.ca</a> a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:41e734cbc4e5487d9fd26b0253e4d173@yukon.ca">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New",serif;}p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-fareast-language:EN-CA;}span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Thanks
            Even,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">I’ve
            narrowed it down to the mask file. When I move it out of the
            way gdal_translate completes without error. Perhaps my
            optimization step of using nearblack on only the infrared
            band instead of all 4 is at fault?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">I
            agree it’s hard to troubleshoot when the examples are not
            self-contained! I wish I were free to share the source
            images. I can share the .msk file though:</span> <span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><a class="moz-txt-link-freetext" href="https://paste.c-net.org/StrapsMaple">https://paste.c-net.org/StrapsMaple</a><o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">(First
            time using this service. I know nothing about it excepting
            it was the 1<sup>st</sup> result when searching for “binary
            pastebin”)<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <div>
          <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Calibri",sans-serif;color:#1F497D"
              lang="EN-US">-Matt</span><i><span
style="font-size:10.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p></o:p></span></i></p>
        </div>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
                  style="font-size:11.0pt;font-family:"Calibri",sans-serif"
                  lang="EN-US">From:</span></b><span
                style="font-size:11.0pt;font-family:"Calibri",sans-serif"
                lang="EN-US"> gdal-dev
                <a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev-bounces@lists.osgeo.org"><gdal-dev-bounces@lists.osgeo.org></a>
                <b>On Behalf Of </b>Even Rouault<br>
                <b>Sent:</b> December 8, 2021 11:08 AM<br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
                <b>Subject:</b> Re: [gdal-dev] Access window out of
                range error with standard utils<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p>Matt,<o:p></o:p></p>
        <p>this is likely a rounding bug somewhere, but I couldn't
          reproduce with what you provided (with GDAL master and 3.3.2
          on Linux). I had to fix a few hardcoded paths in the VRTs and
          create
          SPOT7_FiftyMileCkSixtyMileR_321_150cm_19Jun2015_utm7.tif and
          SPOT7_FiftyMileCkSixtyMileR_432_150cm_19Jun2015_utm7.tif with<o:p></o:p></p>
        <p>gdal_create
          SPOT7_FiftyMileCkSixtyMileR_321_150cm_19Jun2015_utm7.tif
          -outsize 31918 34252 -bands 4 -co tiled=yes -co sparse_ok=yes<br>
          gdaladdo
          SPOT7_FiftyMileCkSixtyMileR_321_150cm_19Jun2015_utm7.tif
          --config SPARSE_OK_OVERVIEW YES       # SPARSE_OK_OVERVIEW
          only taken into account with GDAL master<o:p></o:p></p>
        <p>I also create a .vrt.msk file with<o:p></o:p></p>
        <p>gdal_create
          SPOT7_FiftyMileCkSixtyMileR_321_150cm_19Jun2015_utm7.vrt.msk
          -outsize 31912 34252 -co sparse_ok=yes -mo
          INTERNAL_MASK_FLAGS_1=2 -of gtiff<br>
          gdaladdo
          SPOT7_FiftyMileCkSixtyMileR_321_150cm_19Jun2015_utm7.vrt.msk
          --config SPARSE_OK_OVERVIEW YES<o:p></o:p></p>
        <p>I may have missed something. It would help if your reproducer
          was self contained.<o:p></o:p></p>
        <p>Even<o:p></o:p></p>
        <div>
          <p class="MsoNormal"><span style="font-size:10.0pt">Le
              08/12/2021 à 18:35, <a href="mailto:Matt.Wilkie@yukon.ca"
                moz-do-not-send="true">
                Matt.Wilkie@yukon.ca</a> a écrit :<o:p></o:p></span></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hello,<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Why
              is gdal off by one for the access window? I’m using
              standard utilities, no custom code. This is only happening
              (so far) on one file out of dozens.<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">```<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">$
              gdal_translate -co compress=zstd -co predictor=yes -co
              level=17 ^<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> -co
              bigtiff=yes -of cog INFILE.rgb-nir.vrt OUTFILE.tif<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Input
              file size is 31918, 34252<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">0.ERROR
              5: Access window out of range in RasterIO().  Requested<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">(0,0)
              of size 250x268 on raster of 249x267.<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">```<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">This
              is one step of a process where I’m taking two 3-band
              jpeg-in-geotiff images, defining a nodata mask, and
              creating a final 4-band cloud geotiff. Preceding steps to
              this one are:<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">gdal_translate
              -b 1 RGB.tif  b-red.vrt<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">gdal_translate
              -b 2 RGB.tif  b-grn.vrt<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">gdal_translate
              -b 3 RGB.tif  b-blu.vrt<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">gdal_translate
              -b 1 432.tif  b-nir.vrt<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">gdalbuildvrt
              -separate INFILE.rgb-nir.vrt ^<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> 
              b-red.vrt b-grn.vrt b-blu.vrt b-nir.vrt<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">gdal_translate
              INFILE.rgb-nir.vrt xx-to-mask.tif<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">nearblack
              –setmask xx-to-mask.tif<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">move
              xx-mask.tif.msk INFILE.rgb-nir.vrt.msk<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">del
              xx-mask.tif<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">gdal_translate
              INFILE.rgb-nir.vrt OUTFILE.tif<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">(Edited
              for legibility, options used are left out)<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Gdalinfo
              reports the size of each image are the same:<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">$
              findstr "Size" *.gdal-info<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">RGB.b-blu.vrt.gdal-info:Size
              is 31918, 34252<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">RGB.b-blu.vrt.gdal-info:Pixel
              Size = (1.500000000000000,-1.500000000000000)<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">RGB.b-grn.vrt.gdal-info:Size
              is 31918, 34252<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">RGB.b-grn.vrt.gdal-info:Pixel
              Size = (1.500000000000000,-1.500000000000000)<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">RGB.b-red.vrt.gdal-info:Size
              is 31918, 34252<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">RGB.b-red.vrt.gdal-info:Pixel
              Size = (1.500000000000000,-1.500000000000000)<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">432.b-nir.vrt.gdal-info:Size
              is 31918, 34252<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">432.b-nir.vrt.gdal-info:Pixel
              Size = (1.500000000000000,-1.500000000000000)<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">INFILE.rgb-nir.vrt.gdal-info:Size
              is 31918, 34252<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">INFILE.rgb-nir.vrt.gdal-info:Pixel
              Size = (1.500000000000000,-1.500000000000000)<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">INFILE.rgb-nir.vrt.msk.gdal-info:Size
              is 31918, 34252<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">The
              source VRT and gdalinfo reports are attached.<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">GDAL
              3.3.2, released 2021/09/01 via Qgis 3.22 on Windows 10.<o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span
                  lang="EN-US">Matt Wilkie</span></b><o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                lang="EN-US">Geomatics Developer & Administrator</span><o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                lang="EN-US">Environment | Technology, Innovation and
                Mapping</span><o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
                lang="EN-US">T 867-667-8133 |
              </span><u><a href="http://yukon.ca/"
                  moz-do-not-send="true"><span lang="EN-US">Yukon.ca</span></a></u><o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><i>Hours:
                08:30-16:30, Mon-Wed: Office, Thu: Remote, Fri: Away.</i><o:p></o:p></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
          </div>
          <p class="MsoNormal"><span style="font-size:10.0pt"><br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>gdal-dev mailing list<o:p></o:p></pre>
          <pre><a href="mailto:gdal-dev@lists.osgeo.org" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre>
          <pre><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre>
        </blockquote>
        <pre>-- <o:p></o:p></pre>
        <pre><a href="https://imsva91-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.spatialys.com&umid=B685D7CA-D2A6-5E05-A200-E0AFE3B43C72&auth=c132af8ee7c9d1278d61a701569070a095ce962e-45f9e6e44e2899ec331fad264f0287e272c8edd7" moz-do-not-send="true">http://www.spatialys.com</a><o:p></o:p></pre>
        <pre>My software is free, but my time generally not.<o:p></o:p></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>