Re: urgent help needed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: urgent help needed

Frank Warmerdam
On 9/15/05, hina arif <[hidden email]> wrote:

>  
>  
>
> hi i need help once again same is the way i am  working on .i mean the way i
> read the file is almost same but the problem is that when i read a file
> using GetRasterCount() it says that the file has only one band and then i
> read like that
>
> poBand->GetBlockSize(&nBlockXSize,&nBlockYSize);//resolution
>
>  
>
> pabyData = (GByte
> *)CPLMalloc(nBlockXSize*nBlockYSize*nBand*sizeof(GByte));//heap
> memory
>
> if(pabyData==NULL) error
>
>  
>
> for(int i=0;i<poBand->GetBand();++i)
>
> e=poBand->ReadBlock(i,i,pabyData);
>


Hina,

You should not generally be using the ReadBlock() method. It
is mainly intended for low level applications.  

 > or i used  readIO like this

>
> e=poBand->RasterIO(GF_Read, 0,0,nBlockXSize,
> 0,pabyData,nBlockXSize,0,GDT_Byte,0,0);
>
> if i use value other than 0 an error comes and i think i am reading a band
> located at location 0,0 the first and only one
> my file is of resolution 24810,784200 and its an black and white map image
> file
>
> sorry but i need ur assistance that what is an error in the code  

That is a large file!  Was there a particular reason you were trying
to read based on the block size?  The block size is basically the size
of a chunk in the file.  If you wanted to read just the first block you could
do that

  poBand->RasterIO( GF_Read, 0, 0, nBlockXSize, nBlockYSize,
                              pabyData, nBlockXSize, nBlockYSize,
GDT_Byte, 0, 0 );
 

I'm not sure which zero you were referring to changing .. there are several.

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

_______________________________________________
Gdal-dev mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/gdal-dev