Hi Hari,
26.12.2012 9:16, HariPrasad ?????:
Hi Dmitry
I was inspecting various GDAL sources
(http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts). I was bit confused
how to implement RasterIO method. Which format to look for better idea.
By my opinion the best format is geotiff
Should i call IRasterIO() method in IReadBlock?
/CPLErr RBDRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff, void *
pImage )
{
return IRasterIO( GF_Read, nBlockXOff, nBlockYOff, nBlockXSize,
nBlockYSize,
pImage, nBlockXSize, nBlockYSize, eDataType,
GDALGetDataTypeSize(eDataType)/8, 0 );
}/
/CPLErr RBDRasterBand::IRasterIO( GDALRWFlag eRWFlag,
int nBlockXOff, int nBlockYOff, int
nXSize, int nYSize,
void * pData, int nBufXSize, int
nBufYSize,
GDALDataType eBufType,
int nPixelSpace, int nLineSpace )
{
//my logic
}/
Earlier we were using ERDAS method to get the handle
/long LayerRasterRead( void *lHandle, unsigned long bRow, unsigned long
bCol,
unsigned char **pixels )
{
//logic
}/
Is there any method similar to get the handle in GDAL?
The best starting point is http://gdal.org/gdal_tutorial.html but in
example shown reading of one line of the image.
Reading the whole image will looks like this:
int nPixelSpace(0);
int nLineSpace(0);
int nBandSpace(0);
if(nBandCount > 1)
{
int nDataSize = GDALGetDataTypeSize(eDT) / 8;
nPixelSpace = nDataSize * nBandCount;
nLineSpace = nBufXSize * nPixelSpace;
nBandSpace = nDataSize;
}
void* data = CPLMalloc (nWidth * nHeight * nDataSize *
nBandCount); //allocate memory for pixels
pGDALRaster->RasterIO( GF_Read, nXOff, nYOff, nXSize, nYSize, data,
nWidth, nHeight, eDT, nBandCount, panBandList, nPixelSpace, nLineSpace,
nBandSpace);
Details:
http://gdal.org/classGDALRasterBand.html#a5497e8d29e743ee9177202cb3f61c3c7
If nWidth != nXSize and nYSize != nHeight the closest overview will be
used for fast access to pixel data.
If eDT == /GDT_Byte/you can write: unsigned char* pixels = (unsigned
char*) data;
--
View this message in
context:http://osgeo-org.1560.n6.nabble.com/Overviews-using-GDAL-tp5022226p5024588.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Best regards,
Dmitry
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev