<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Sean,</p>
    <p>did you implement the Stat() method ? From gdalpamdataset.cpp
      lines 921 to 940, for .aux.xml to be used, you either need to
      implement ReadDir()/VSISiblingFiles or Stat(). Actually, I'd
      strongly recommend implementing Stat() as a lot of places will
      assume it to be working. As you can skip establishing the
      directory listing with GDAL_DISABLE_READDIR_ON_OPEN, all code
      should be robust to an empty readdir() result, but it will then
      assume Stat() to work.<br>
    </p>
    <p>The .aux file is a different story, since it is actually
      attempted to be opened with GDALOpen(), which first tries a
      Open(), and doesn't require Stat() to succeed.</p>
    <p>.ovr files are only attempted to be opened if you do a RasterIO()
      call that involves subsampling.  A plain GDALOpen() on a .tif
      doesn't involve sidecar file loading. The GTiff reader implements
      a on-demand logic to try to open them</p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 17/02/2024 à 00:00, Sean Gillies via
      gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOodmJq6BVe9=_cyTGGOH5CLOF4gXtzzPqoNyZ4jyjAP3qMZvQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Update... It looks like there are at least two different
          kinds of logic around sidecar/sibling files.</div>
        <div><br>
        </div>
        <div>My Rasterio VSI plugin currently implements only open,
          tell, seek, read, write, and close. The mandatory methods. I
          can see GDAL probing for .aux and .AUX files. But not .aux.xml
          files for some reason that I don't understand. The dataset I'm
          exposing through this VSI plugin has a .ovr file, but there's
          no attempt to find it. It looks like .aux.xml and .ovr require
          VSI sibling files and/or readdir support, but that .aux file
          support does not? I'm deducing this from the behavior of the
          system. It would be hard to figure it out just by reading the
          code.</div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Fri, Feb 16, 2024 at
            8:29 AM Sean Gillies <<a
              href="mailto:sean.gillies@gmail.com"
              moz-do-not-send="true" class="moz-txt-link-freetext">sean.gillies@gmail.com</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div dir="ltr">
              <div>Thanks for the tip, Thomas!<br>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Thu, Feb 15, 2024
                  at 9:45 AM thomas bonfort <<a
                    href="mailto:thomas.bonfort@gmail.com"
                    target="_blank" moz-do-not-send="true"
                    class="moz-txt-link-freetext">thomas.bonfort@gmail.com</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                  <div dir="ltr">
                    <div>Hi Sean,</div>
                    <div>I believe/recall this is very driver dependent.
                      Some drivers will look for their sidecars in the
                      provided sibling files list returned by
                      VSISiblingFiles, whereas others will
                      unconditionally try to open well-known sidecar
                      names they will have computed from their own name.
                      IIRC I added VSISiblingFiles so that some vsi
                      backends (namely object storage based ones) could
                      explicitly return an empty list of sibling files
                      in order to prevent drivers to emit a subsequent
                      Readdir() (which might break drivers that require
                      sidecar files to work, but speeds up those where
                      sidecar files are optional and not used in a
                      cloud-storage environment (namely cogs) )<br>
                    </div>
                  </div>
                  <br>
                  <div class="gmail_quote">
                    <div dir="ltr" class="gmail_attr">On Tue, Feb 13,
                      2024 at 6:12 PM Sean Gillies via gdal-dev <<a
                        href="mailto:gdal-dev@lists.osgeo.org"
                        target="_blank" moz-do-not-send="true"
                        class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a>>
                      wrote:<br>
                    </div>
                    <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                      <div dir="ltr">
                        <div>Hi all,<br>
                        </div>
                        <div><br>
                        </div>
                        <div>It's not clear to me from reading <a
href="https://gdal.org/user/virtual_file_systems.html" target="_blank"
                            moz-do-not-send="true"
                            class="moz-txt-link-freetext">https://gdal.org/user/virtual_file_systems.html</a>
                          if VSI sidecar and sibling file lookup works
                          in general, by design, or whether it's an
                          implementation detail of the standard VSI
                          filesystems ("vsizip", "vsicurl", etc.).<br>
                        </div>
                        <div><br>
                        </div>
                        <div>More specifically: if I have a
                          "/vsipyopener/foo.tif" object, do drivers
                          always look for other files at paths precisely
                          relative to that one? Does this vary among
                          drivers?</div>
                      </div>
                    </blockquote>
                  </div>
                </blockquote>
              </div>
              <br clear="all">
              <br>
              <span class="gmail_signature_prefix">-- </span><br>
              <div dir="ltr" class="gmail_signature">Sean Gillies</div>
            </div>
          </blockquote>
        </div>
        <br clear="all">
        <br>
        <span class="gmail_signature_prefix">-- </span><br>
        <div dir="ltr" class="gmail_signature">Sean Gillies</div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="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="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>