[Gdal-dev] problem about "RasterIO"
Frank Warmerdam
warmerdam at pobox.com
Mon Oct 9 13:17:59 EDT 2006
qq wrote:
> HI:
>
> I tried to read a .tif file with data type of "GDT_Byte" using the
> method of "RasterIO". It did well without problem. But When I tied to
> read a .tif file with data type of "GDT_Int32", it did't work. My code
> is here:
>
> if (RasterBand->GetRasterDataType() == GDT_Int32){
> LONG* pData;
> pData = (LONG*) CPLMalloc(sizeof(LONG)*nXSize*nYSize);
> RasterBand->RasterIO( GF_Read, 0, 0, nXSize, nYSize, pData, nXSize,
> nYSize, GDT_Int32, 0, 0 );
> }
>
> The pData is NULL. And the image data can't be read from the file. Would
> anyone tell what is the wrong? Thanks !
QQ,
It sounds like the buffer allocation is failing because of a lack
of memory. Is your file large?
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 | President OSGeo, http://osgeo.org
More information about the Gdal-dev
mailing list