[Gdal-dev] problem about "RasterI O"

Ray Gardener rayg at daylongraphics.com
Tue Oct 10 00:46:23 EDT 2006


The size of the TIFF files may be misleading if they are compressed; the
final nXSize and nYSize may require a buffer that takes too much memory.
Do you know the pixel dimensions of the files?

Ray


qq wrote:
> 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 ÊÕ¼þÈË:
> "qq" ³­ËÍ: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 !
> 
> 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 <http://osgeo.org/>
> 
> 
> 
> 
> 
> 
> 
> 
> ÃÀ Å® ¿Ö ²À °Ü ¼Ò Ðã ( ×é ͼ ) ¶À ¼Ò Åû ¶ ! С ×Ê Å® ÈË 8 ¸ö ¾ø ¶¥ Òþ ÃØ µÄ Ȥ Ê ( ×é ͼ ) 
> <http://adtaobao.allyes.com/main/adfclick?db=adtaobao&bid=600,597,58&cid=29985,198,1&sid=32501&show=ignore&url=http://www.taobao.com/vertical/lady/pro.php>
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> _______________________________________________ Gdal-dev mailing list
>  Gdal-dev at lists.maptools.org 
> http://lists.maptools.org/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list