[gdal-dev] How proceed with GDAL GeoTIFF files with multiply subdataset
Raivo Rebane
raivo at r-systems.ee
Wed Mar 8 11:54:37 PST 2023
Hi
now I am using following c++ commands to read pages from
multisubdatasets Geotiff file :
dataset =
static_cast<GDALDataset*>(GDALOpen(TiffFullName.c_str(), GA_ReadOnly));
if (dataset == NULL) {
std::cout << "Failed to open subdataset nr = " << subsets
<< " Read command = " << TiffFullName << std::endl;
break;
}
else
std::cout << "Subdataset readed = " << subsets << " Read
command = " << TiffFullName << std::endl;
And getting following result :
Subdataset readed = 1 Read command =
GTIFF_DIR:1:F:\3D-data\GeoTIFFs\autzen.1.tiff
ERROR 4: F:\3D-data\GeoTIFFs\autzen.1.tiff: Requested directory 2 not found.
Failed to open subdataset nr = 2 Read command =
GTIFF_DIR:2:F:\3D-data\GeoTIFFs\autzen.1.tiff
Does this command works properly and how I can get information about
subdatasets in GeoTiff file
Regards
Raivo
On 08.03.23 14:54, 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
>
> 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/732be3f1/attachment.htm>
More information about the gdal-dev
mailing list