[gdal-dev] loading many files with C API

Yann Chemin yann.chemin at gmail.com
Sun Nov 23 22:34:45 EST 2008


Hello,

I need to load about 400 files with the C API to work on each pixel
temporal dimension.

I would like to make a look to load them but fail so far...

GDALDatasetH hDataset[MAXFILES];
GDALAllRegister();
GDALDriverH hDriver[MAXFILES];
GDALRasterBandH hBand[MAXFILES];
float *pafScanline[MAXFILES];
int nXSize1,nYSize1;

//loading input files
for(i=0;i<n_imgs;i++){
    in[i] = argv[i+1];
    hDataset[i] = GDALOpen(in[i];GA_ReadOnly);
    hDriver[i] = GDALDatasetDriver(hDataset[i]);
    hBand[i] = GDALGetRasterBand(hDataset[i],1);
    nXSize1 = GDALGetRasterBandXSize(hBand[0]);
    pafScanline[i] = (float *) CPLMalloc(sizeof(float)*nXSize1);
}

it mentions error 10: 'hDataset' is NULL in 'GDALGetDatasetDriver'

I suppose my definition of hDataset[ ] is wrong... Could anybody help
out please?
Thanks
Yann

-- 
Yann Chemin
International Rice Research Institute
Office: http://www.irri.org/gis
Perso: http://www.freewebs.com/ychemin
YiKingDo: http://yikingdo.unblog.fr/


More information about the gdal-dev mailing list