<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi</p>
    <p>now I am using following c++ commands to read pages from
      multisubdatasets Geotiff file :</p>
    <p>        dataset =
      static_cast<GDALDataset*>(GDALOpen(TiffFullName.c_str(),
      GA_ReadOnly));<br>
              if (dataset == NULL) {<br>
                  std::cout << "Failed to open subdataset nr = "
      << subsets << " Read command =  " <<
      TiffFullName << std::endl;<br>
                  break;<br>
              }<br>
              else<br>
                  std::cout << "Subdataset readed = " <<
      subsets << " Read command =  " << TiffFullName
      << std::endl;<br>
    </p>
    <p>And getting following result :</p>
    <p>Subdataset readed = 1 Read command = 
      GTIFF_DIR:1:F:\3D-data\GeoTIFFs\autzen.1.tiff<br>
      ERROR 4: F:\3D-data\GeoTIFFs\autzen.1.tiff: Requested directory 2
      not found.<br>
      Failed to open subdataset nr = 2 Read command = 
      GTIFF_DIR:2:F:\3D-data\GeoTIFFs\autzen.1.tiff</p>
    <p>Does this command works properly and how I can get information
      about subdatasets in GeoTiff file</p>
    <p>Regards</p>
    <p>Raivo<br>
    </p>
    <div class="moz-cite-prefix">On 08.03.23 14:54, Raivo Rebane wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:faed0332-957f-bb8d-1073-aeed0ff81806@r-systems.ee">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <p>Hi<br>
      </p>
      <p>I found from documentation following about subdataset:</p>
      <div class="moz-forward-container">
        <h3>Subdatasets<a class="headerlink"
            href="https://gdal.org/drivers/raster/gtiff.html#subdatasets"
            title="Permalink to this heading" moz-do-not-send="true"></a></h3>
        <p>Multi-page TIFF files are exposed as subdatasets. On opening,
          a subdataset name is GTIFF_DIR:{index}:filename.tif, where
          {index} starts at 1.</p>
        <p>I am using following code :</p>
        <p>  GDALDataset* subdataset =
static_cast<GDALDataset*>(GDALOpen("F:\\3D-data\\GeoTIFFs\\[1]:44744.tif",
          GA_ReadOnly));<br>
              if (subdataset == NULL) {<br>
                  std::cout << "Failed to open subdataset!"
          << std::endl;<br>
                  return 1;<br>
              }<br>
        </p>
        <p>But geting following :</p>
        <p>subdataset = NULL</p>
        <p>From documentation I didn't find more</p>
        <p>In what I am wrong</p>
        <p>Regards</p>
        <p>Raivo<br>
        </p>
        <p><br>
        </p>
        <div class="moz-cite-prefix">On 08.03.23 01:01, Brad Hards
          wrote:<br>
        </div>
        <blockquote type="cite" cite="mid:12164630.O9o76ZdvQC@audax">
          <pre class="moz-quote-pre" wrap="">On Wednesday, 8 March 2023 6:53:17 AM AEDT Raivo Rebane wrote:
</pre>
          <blockquote type="cite">
            <pre class="moz-quote-pre" wrap="">I studied and asked from <a class="moz-txt-link-freetext" href="https://chat.openai.com/chat" moz-do-not-send="true">https://chat.openai.com/chat</a> how to read
multiband raster image, but I did'nt find anywhere how to rread from
tiff file next frame or ortofo bands

Please ask me if it's possible
</pre>
          </blockquote>
          <pre class="moz-quote-pre" wrap="">It is possible. See <a class="moz-txt-link-freetext" href="https://gdal.org/drivers/raster/gtiff.html#subdatasets" moz-do-not-send="true">https://gdal.org/drivers/raster/gtiff.html#subdatasets</a> for 
how the multiple images are identified.

Use gdalinfo on your file to see the specific characteristics.

See <a class="moz-txt-link-freetext" href="https://gdal.org/tutorials/raster_api_tut.html" moz-do-not-send="true">https://gdal.org/tutorials/raster_api_tut.html</a> for use of the Raster API 
abstraction.

So you just need to pass the correct name to the open call.


Brad



_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:gdal-dev@lists.osgeo.org" moz-do-not-send="true">gdal-dev@lists.osgeo.org</a>
<a class="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>
      </div>
    </blockquote>
  </body>
</html>