[gdal-dev] loading many files with C API

Frank Warmerdam warmerdam at pobox.com
Sun Nov 23 23:35:21 EST 2008


Yann Chemin wrote:
> 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'

Yann,

Is that the first error reported?  Does it occur for i==0 or much later
(perhaps around the 250th file)? Many operating systems have a limit
on the number of files that can be open at once, in some cases around
256.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list