1. 程式人生 > >利用GDAL庫讀取GeoTIFF檔案

利用GDAL庫讀取GeoTIFF檔案

   BYTE *pafScanblock1;
   BYTE *pafScanblock2;
   BYTE *pafScanblock3;
   pafScanblock1 = (BYTE *) CPLMalloc(sizeof(BYTE)*(nBufferSizeX)*(nBufferSizeY));
   pafScanblock2 = (BYTE *) CPLMalloc(sizeof(BYTE)*(nBufferSizeX)*(nBufferSizeY));
   pafScanblock3 = (BYTE *) CPLMalloc(sizeof(BYTE)*(nBufferSizeX)*(nBufferSizeY));
   poBand1->RasterIO( GF_Read, 0, 0,nBufferSizeX,nBufferSizeY,
   pafScanblock1,nBufferSizeX,nBufferSizeY, GDT_Byte,0, 0 );
   poBand2->RasterIO( GF_Read, 0, 0,nBufferSizeX,nBufferSizeY,
   pafScanblock2,nBufferSizeX,nBufferSizeY, GDT_Byte,0, 0 );
   poBand3->RasterIO( GF_Read, 0, 0,nBufferSizeX,nBufferSizeY,
   pafScanblock3,nBufferSizeX,nBufferSizeY, GDT_Byte,0, 0 );