In the above example, we first open a raster dataset and then get the first raster band using the GetRasterBand method. We then use the GetYSize method to retrieve the number of rows in the raster and print it to the console. Example 2:c++ void printRasterDimensions(GDALRasterBand* poBand) { int width = poBand->GetXSize(); int height = poBand->GetYSize(); std::cout << "Raster Dimensions: " << width << " x " << height << std::endl; } int main() { GDALAllRegister(); GDALDataset* poDataset = (GDALDataset*) GDALOpen("my_raster.tif", GA_ReadOnly); GDALRasterBand* poBand = poDataset->GetRasterBand(1); printRasterDimensions(poBand); GDALClose(poDataset); return 0; } ``` In this example, we define a function called `printRasterDimensions` that takes in a GDALRasterBand pointer and prints the width and height of the raster. We then use this function to print the dimensions of a raster after opening it using GDALOpen. We also end by closing the dataset to free up memory resources. The package library for the GDAL library is gdal.h.