[gdal-dev] Extracting cell values from a big image and many smaller images

Frank Warmerdam warmerdam at pobox.com
Fri Feb 29 11:46:37 EST 2008


Limei Ran wrote:
> 
> Hi:
> 
> I am using GDAL cpp library to create a program. The program will 
> ultimately generate a statistic table with cell values from a very big 
> modeling grid domain image (almost whole US) and many smaller land use 
> images within the big image.
> 
> I need to go through all the small image pixels to match grid cell 
> values in the big image. There are many ways to read image data in line 
> and blocks from GDALRasterBand class.
> 
> Since I am new in using GDAL libraries, I appreciate any suggestion you 
> might have in accessing the images efficiently.

Limei,

I'm not exactly clear on what you want to do, but a couple hints:

  - Avoid doing many one pixel reads with RasterIO().  There is quite
    a bit of overhead in each call and so you should only do one pixel
    reads when that is all you really need.  I believe even with caching
    using one pixel reads to read a whole scanline would be easily an
    order of magnitude slower than doing one full scanline read.

  - If you will be accessing your huge image in local chunks, consider
    organizing it as a tiled image.  Perhaps an imagine (HFA) file or
    a BigTIFF with tiling.

  - If you need precision, and your small land use images are for
    reasonably small areas, I would suggest just loading all the data from
    the big image that matches the area for the small image in one gulp
    (one RasterIO() call).  Then do your matching analysis and then move
    on to the next.

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



More information about the gdal-dev mailing list