<div dir="ltr"><div>Hi Even,<br></div><div><br></div><div>This episode is a reminder that making quotation marks part of the GDAL filename syntax was a mistake. Reverting it would be a big effort, but at the very least we should stop propagating it. Specifically, if a new driver with subdataset capabilities were to be written tomorrow it should be forbidden from relying on quotation marks<br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 22, 2024 at 5:32 AM Even Rouault via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org">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"><u></u>

  
    
  
  <div>
    <p>If you struggle with quoting, the easiest would be to "alias"
      complex connections strings as VRT with</p>
    <p>gdal_translate "STACIT: .. complex stuff here.."  my_stacit.vrt</p>
    <p>and the use "vrt://my_stacit.vrt?...."</p>
    <p>There should be hardly any performance overhead doing that since
      the VRT driver is optimized to detect situations like that where
      it is used as a passthrough.<br>
    </p>
    <p>On Linux/Unix you can actually avoid creating an actual vrt file
      and just create a symbolic link:</p>
    <p>$ ln -sf
"STACIT:\<a href="https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..%5C" target="_blank">"https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..\"</a>:asset=image"
      my_stacit<br>
      $ gdalinfo vrt://my_stacit <br>
    </p>
    <p>That's a trick I use often to make it easier in QGIS to use such
      non-file datasets.<br>
    </p>
    <p></p>
    <div>Le 22/11/2024 à 10:53, Rahkonen Jukka
      via gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite">
      
      
      
      <div>
        <p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
        <p class="MsoNormal"><span><u></u> <u></u></span></p>
        <p class="MsoNormal"><span lang="EN-US">In case of STACIT, I can’t discover how to use
            the vrt:// connection string
            <a href="https://gdal.org/en/latest/drivers/raster/vrt.html#vrt-connection-string" target="_blank">
https://gdal.org/en/latest/drivers/raster/vrt.html#vrt-connection-string</a>
            with subdataset name (or even without). Can you?<br>
            <br>
            Start with <br>
             gdalinfo 
"STACIT:\<a href="https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip%5E&bbox=-100,40,-99,41%5E&datetime=2019-01-01T00:00:00Z%2F..%5C" target="_blank">https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip^&bbox=-100,40,-99,41^&datetime=2019-01-01T00:00:00Z%2F..\</a><br>
            and try to show a vrt:// string for<br>
             
SUBDATASET_1_NAME=STACIT:<a href="https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..:asset=image" target="_blank">https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=naip&bbox=-100,40,-99,41&datetime=2019-01-01T00:00:00Z%2F..:asset=image</a><u></u><u></u></span></p>
        <p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
        <p class="MsoNormal"><span lang="EN-US">-Jukka-<u></u><u></u></span></p>
        <p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
        <div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0cm 0cm">
          <p class="MsoNormal"><b>Lähettäjä:</b> Michael Sumner
            <a href="mailto:mdsumner@gmail.com" target="_blank"><mdsumner@gmail.com></a> <br>
            <b>Lähetetty:</b> perjantai 22. marraskuuta 2024 11.10<br>
            <b>Vastaanottaja:</b> Rahkonen Jukka
            <a href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank"><jukka.rahkonen@maanmittauslaitos.fi></a><br>
            <b>Aihe:</b> Re: [gdal-dev] Issue with the STACIT usage
            examples<u></u><u></u></p>
        </div>
        <p class="MsoNormal"><u></u> <u></u></p>
        <div>
          <div>
            <p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
            <div>
              <div>
                <p class="MsoNormal">On Fri, 22 Nov 2024, 03:52 Rahkonen
                  Jukka via gdal-dev, <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>>
                  wrote:<u></u><u></u></p>
              </div>
              <blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
                <div>
                  <div>
                    <p class="MsoNormal"><span lang="EN-US">Understood, and good reason to
                        start using the new gdalinfo convenience option
                        "-sd" for selecting sub-datasets by their index.</span><u></u><u></u></p>
                  </div>
                </div>
              </blockquote>
            </div>
          </div>
          <div>
            <p class="MsoNormal"><u></u> <u></u></p>
          </div>
          <div>
            <p class="MsoNormal">Do beware that index isn't necessarily
              reliable (good old netcdf), it can change through an
              ostensibly consistent dataset while name does remain
              robust.<u></u><u></u></p>
          </div>
          <div>
            <p class="MsoNormal"><u></u> <u></u></p>
          </div>
          <div>
            <p class="MsoNormal">vrt:// has sd_name for this purpose,
              and to avoid driver declaration with full subdataset
              syntax. <u></u><u></u></p>
          </div>
          <div>
            <p class="MsoNormal"><u></u> <u></u></p>
          </div>
          <div>
            <p class="MsoNormal">I may have considered sd_name for
              gdalinfo ?? probably a good idea. And maybe something to
              put on the 4.0 break list
              <span style="font-family:"Segoe UI Emoji",sans-serif">🙏</span><u></u><u></u></p>
          </div>
          <div>
            <p class="MsoNormal"><u></u> <u></u></p>
          </div>
          <div>
            <p class="MsoNormal">Cheers, Mike<u></u><u></u></p>
          </div>
          <div>
            <div>
              <blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
                <div>
                  <div>
                    <p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
                    <p class="MsoNormal"><span lang="SV">gdalinfo "STACIT:\</span><span lang="EN-US"><a href="https://paituli.csc.fi/geoserver/ogc/stac/v1/search?collections=corine_land_cover_at_geocubes%5C" target="_blank"><span lang="SV">https://paituli.csc.fi/geoserver/ogc/stac/v1/search?collections=corine_land_cover_at_geocubes\</span></a></span><span lang="SV">" -sd 2</span><u></u><u></u></p>
                    <p class="MsoNormal"><span lang="SV"> </span><u></u><u></u></p>
                    <p class="MsoNormal"><span lang="SV">-Jukka-</span><u></u><u></u></p>
                    <p class="MsoNormal"><span lang="SV"> </span><u></u><u></u></p>
                    <div>
                      <div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) currentcolor currentcolor;padding:3pt 0cm 0cm">
                        <p class="MsoNormal"><b>Lähettäjä:</b>
                          Even Rouault <<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>>
                          <br>
                          <b>Lähetetty:</b> torstai 21. marraskuuta 2024
                          18.36<br>
                          <b>Vastaanottaja:</b> Rahkonen Jukka <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank">jukka.rahkonen@maanmittauslaitos.fi</a>>;
                          Daniel Evans <<a href="mailto:daniel.fred.evans@gmail.com" target="_blank">daniel.fred.evans@gmail.com</a>><br>
                          <b>Kopio:</b> '<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>'
                          (<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>)
                          <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>><br>
                          <b>Aihe:</b> Re: [gdal-dev] Issue with the
                          STACIT usage examples<u></u><u></u></p>
                      </div>
                    </div>
                    <p class="MsoNormal"> <u></u><u></u></p>
                    <p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
                    <blockquote style="margin-top:5pt;margin-bottom:5pt">
                      <div>
                        <p class="MsoNormal"> <u></u><u></u></p>
                        <p class="MsoNormal"><span lang="EN-US">However, the subdataset names
                            on the list are not accepted as-is without
                            small edits.<br>
                            Does not work:<br>
                            gdalinfo STACIT:<a href="https://paituli.csc.fi/geoserver/ogc/stac/v1/search?collections=corine_land_cover_at_geocubes" target="_blank">"https://paituli.csc.fi/geoserver/ogc/stac/v1/search?collections=corine_land_cover_at_geocubes"</a>:asset=1000m</span><u></u><u></u></p>
                      </div>
                    </blockquote>
                    <p>That's "expected". Subdataset names are designed
                      to be used verbatim by GDALOpen(). The STACIT
                      driver isn't aware it has been invoked from a
                      shell and which quoting rules would apply.<u></u><u></u></p>
                    <p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p><br></div></div></blockquote></div></div></div></div>
    </blockquote><br>
</div></blockquote></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Sean Gillies</div></div>