<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-text-html" lang="x-western">
      <div class="moz-text-html" lang="x-western">
        <div class="moz-cite-prefix">Hi Hari,<br>
          <br>
          26.12.2012 9:16, HariPrasad пишет:<br>
        </div>
        <blockquote cite="mid:1356498962396-5024588.post@n6.nabble.com"
          type="cite">
          <pre wrap="">Hi Dmitry

I was inspecting various GDAL sources
(<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts">http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts</a>). I was bit confused
how to implement RasterIO method. Which format to look for better idea.</pre>
        </blockquote>
        By my opinion the best format is geotiff <br>
        <blockquote cite="mid:1356498962396-5024588.post@n6.nabble.com"
          type="cite">
          <pre wrap="">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?</pre>
        </blockquote>
        The best starting point is <a class="moz-txt-link-freetext"
          href="http://gdal.org/gdal_tutorial.html">http://gdal.org/gdal_tutorial.html</a>
        but in example shown reading of one line of the image.<br>
        Reading the whole image will looks like this:<br>
        <br>
            int nPixelSpace(0); <br>
            int nLineSpace(0); <br>
            int nBandSpace(0); <br>
            if(nBandCount > 1) <br>
            { <br>
                int nDataSize = GDALGetDataTypeSize(eDT) / 8; <br>
                nPixelSpace = nDataSize * nBandCount; <br>
                nLineSpace = nBufXSize * nPixelSpace; <br>
                nBandSpace = nDataSize; <br>
            } <br>
            void*    data = CPLMalloc (nWidth * nHeight * nDataSize *
        nBandCount); //allocate memory for pixels <br>
            pGDALRaster->RasterIO( GF_Read, nXOff, nYOff, nXSize,
        nYSize, data, nWidth, nHeight, eDT, nBandCount, panBandList,
        nPixelSpace, nLineSpace, nBandSpace);<br>
        Details: <a class="moz-txt-link-freetext"
href="http://gdal.org/classGDALRasterBand.html#a5497e8d29e743ee9177202cb3f61c3c7">http://gdal.org/classGDALRasterBand.html#a5497e8d29e743ee9177202cb3f61c3c7</a>
        <br>
        <br>
        If nWidth != nXSize and nYSize != nHeight the closest overview
        will be used for fast access to pixel data.<br>
        <br>
        If eDT == <em style="color: rgb(0, 0, 0); font-family: 'Lucida
          Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px;
          font-variant: normal; font-weight: normal; letter-spacing:
          normal; line-height: normal; orphans: 2; text-align: start;
          text-indent: 0px; text-transform: none; white-space: normal;
          widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto;
          -webkit-text-stroke-width: 0px; background-color: rgb(251,
          252, 253);">GDT_Byte</em><span style="color: rgb(0, 0, 0);
          font-family: 'Lucida Grande', Verdana, Geneva, Arial,
          sans-serif; font-size: 12px; font-style: normal; font-variant:
          normal; font-weight: normal; letter-spacing: normal;
          line-height: normal; orphans: 2; text-align: start;
          text-indent: 0px; text-transform: none; white-space: normal;
          widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto;
          -webkit-text-stroke-width: 0px; background-color: rgb(251,
          252, 253); display: inline !important; float: none;"> you can
          write: unsigned char* pixels = (</span><span style="color:
          rgb(0, 0, 0); font-family: 'Lucida Grande', Verdana, Geneva,
          Arial, sans-serif; font-size: 12px; font-style: normal;
          font-variant: normal; font-weight: normal; letter-spacing:
          normal; line-height: normal; orphans: 2; text-align: start;
          text-indent: 0px; text-transform: none; white-space: normal;
          widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto;
          -webkit-text-stroke-width: 0px; background-color: rgb(251,
          252, 253); display: inline !important; float: none;"><span
            style="color: rgb(0, 0, 0); font-family: 'Lucida Grande',
            Verdana, Geneva, Arial, sans-serif; font-size: 12px;
            font-style: normal; font-variant: normal; font-weight:
            normal; letter-spacing: normal; line-height: normal;
            orphans: 2; text-align: start; text-indent: 0px;
            text-transform: none; white-space: normal; widows: 2;
            word-spacing: 0px; -webkit-text-size-adjust: auto;
            -webkit-text-stroke-width: 0px; background-color: rgb(251,
            252, 253); display: inline !important; float: none;">unsigned
            char*</span>)</span>   data; <br>
        <blockquote cite="mid:1356498962396-5024588.post@n6.nabble.com"
          type="cite">
          <pre wrap="">--
View this message in context: <a class="moz-txt-link-freetext" href="http://osgeo-org.1560.n6.nabble.com/Overviews-using-GDAL-tp5022226p5024588.html">http://osgeo-org.1560.n6.nabble.com/Overviews-using-GDAL-tp5022226p5024588.html</a>
Sent from the GDAL - Dev mailing list archive at Nabble.com.
_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a>

</pre>
        </blockquote>
        Best regards,<br>
            Dmitry<br>
      </div>
    </div>
  </body>
</html>