[gdal-dev] How proceed with GDAL GeoTIFF files with multiply subdataset

Raivo Rebane raivo at r-systems.ee
Wed Mar 8 04:54:39 PST 2023


Hi

I found from documentation following about subdataset:


      Subdatasets <https://gdal.org/drivers/raster/gtiff.html#subdatasets>

Multi-page TIFF files are exposed as subdatasets. On opening, a 
subdataset name is GTIFF_DIR:{index}:filename.tif, where {index} starts 
at 1.

I am using following code :

   GDALDataset* subdataset = 
static_cast<GDALDataset*>(GDALOpen("F:\\3D-data\\GeoTIFFs\\[1]:44744.tif", 
GA_ReadOnly));
     if (subdataset == NULL) {
         std::cout << "Failed to open subdataset!" << std::endl;
         return 1;
     }

But geting following :

subdataset = NULL

 From documentation I didn't find more

In what I am wrong

Regards

Raivo


On 08.03.23 01:01, Brad Hards wrote:
> On Wednesday, 8 March 2023 6:53:17 AM AEDT Raivo Rebane wrote:
>> I studied and asked fromhttps://chat.openai.com/chat  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
> It is possible. Seehttps://gdal.org/drivers/raster/gtiff.html#subdatasets  for
> how the multiple images are identified.
>
> Use gdalinfo on your file to see the specific characteristics.
>
> Seehttps://gdal.org/tutorials/raster_api_tut.html  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
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230308/63dcc572/attachment.htm>


More information about the gdal-dev mailing list