Hi, Do you know that your source file is a multipage TIFF? Could you share a small test file? There is python test for reading a multipage TIFF at https://github.com/OSGeo/gdal/blob/master/autotest/gcore/tiff_read.py#L582, please have a look.
-Jukka Rahkonen- Lähettäjä: gdal-dev <[email protected]> Puolesta Raivo Rebane Lähetetty: keskiviikko 8. maaliskuuta 2023 14.55 Vastaanottaja: GDAL <[email protected]> Aihe: [gdal-dev] How proceed with GDAL GeoTIFF files with multiply subdataset Hi I found from documentation following about subdataset: Subdatasets•<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgdal.org%2Fdrivers%2Fraster%2Fgtiff.html%23subdatasets&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2c9de6f7bf72448ceb7008db1fd457ee%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C638138769088912458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=G%2Fls8czdoflmK70QnDVjJK%2B8U271BLdVxtp%2FKRoKLZM%3D&reserved=0> 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 from https://chat.openai.com/chat<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fchat.openai.com%2Fchat&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2c9de6f7bf72448ceb7008db1fd457ee%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C638138769088912458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2BK7Ib0GPmnDTNx4PXyxJ1DvTYZiVUpm69btKTghav0o%3D&reserved=0> 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. See https://gdal.org/drivers/raster/gtiff.html#subdatasets<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgdal.org%2Fdrivers%2Fraster%2Fgtiff.html%23subdatasets&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2c9de6f7bf72448ceb7008db1fd457ee%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C638138769088912458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=G%2Fls8czdoflmK70QnDVjJK%2B8U271BLdVxtp%2FKRoKLZM%3D&reserved=0> for how the multiple images are identified. Use gdalinfo on your file to see the specific characteristics. See https://gdal.org/tutorials/raster_api_tut.html<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgdal.org%2Ftutorials%2Fraster_api_tut.html&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2c9de6f7bf72448ceb7008db1fd457ee%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C638138769088912458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VISqRXj3atPZ6s0d2NWbIfywT6%2BcwQYI9VvCzV2kBPo%3D&reserved=0> 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 [email protected]<mailto:[email protected]> https://lists.osgeo.org/mailman/listinfo/gdal-dev<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2c9de6f7bf72448ceb7008db1fd457ee%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C638138769088912458%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=nK2Uwqq6XlbEuHOmT1wktRZstvg5scKU6dy44WLhZ7I%3D&reserved=0>
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
