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

Brad Hards bradh at frogmouth.net
Wed Mar 8 15:02:13 PST 2023


On Wednesday, 8 March 2023 11:54:39 PM AEDT Raivo Rebane wrote:
> 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

I already identified a way to do this:

> > Use gdalinfo on your file to see the specific characteristics.

What does your file show?

Brad




More information about the gdal-dev mailing list