[gdal-dev] [GDAL dev][GDALRasterBand::IReadBlock] About how to read all the raster bands.

Cherif Oueslati oueslati.cherif at gmail.com
Fri Oct 10 03:22:14 EDT 2008


Hello,



I am implementing a format specific driver to add new format. So i have to
read raster bands from a file in addition of the metadata given in the
header.

The gdalinfo.exe is working effeciently, by using an OGRSpatialReference
object. However i found a problem with the gdal_translate.exe application.

In fact, and when debugging, an error appears indicating that it's
impossible to write in certain memory address, knowing that the input file
to read contain 501 pixels (corresponding to nBlockXSize) and 501 lines
(corresponding to nBlockYSize).

To avoid this problem, i changed the number of iterations in the for loop,
which is allowing reading all the raster bands and filling into the pImage,
from (nBlockXSize*nBlockYSize) to (nBlockXSize*125).

As a consequence i obtain an image that is a part of the whole image to read
which is logic, since i'm not putting all the raster bands.



So to summarise the problem: (nBlockXSize*125) is the maximum rows that i
can put into the destination file image or i have to use all the
(nBlockXSize*nBlockYSize) raster bands.

I think that it's related to the default size of the destination file image.

I used CPLMalloc, CPLRealloc, memset and memcpy functions but it was
fruitless. Could you tell me how to modify this default size?

Otherwise have you any other suggestions.



With all my regards.

Cherif OUESLATI
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20081010/ee896b36/attachment.html


More information about the gdal-dev mailing list