[Gdal-dev] problem about "RasterI O"

qq myicqmail at 163.com
Mon Oct 9 20:59:45 EDT 2006

Hi Warmerdam:
    The first file I tried to read is a .tif about 70M. Another file is a  .img
file about 10M. Both those two files can be opend by ArcGIS software. But I failed to read them by GDAL. Are the parameters which i set in RasterIO wrong ?
Best regards.

·¢¼þÈË:"Frank Warmerdam" 
·¢ËÍʱ¼ä:2006-10-10 01:17:59
³­ËÍ:gdal-dev at lists.maptools.org
Ö÷Ìâ:Re: [Gdal-dev] problem about "RasterIO"

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 !


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20061010/9b6947c6/attachment.html

More information about the Gdal-dev mailing list