[Gdal-dev] How to access 2-D arrays returned by GDALRasterIO?

Bruce Raup brauplists at gmail.com
Mon Jul 10 14:46:49 EDT 2006


Hi all,

I'm building a simple application using GDAL for image I/O.  I want to
extract different subsets from an image band, and for each subset, do
math with each of the elements within.  Ideally I would like to do
this in the natural syntax subset[i][j], rather than subset[j*ncol+i].

I am using GDALRasterIO to retrieve the subsets, putting the result in
dynamically allocated memory, obtained using CPLMalloc.  I'm using
CPLMalloc because it's in the GDAL examples, but I really don't know
what its advantages are, as I haven't found docs on it.  So my
questions are:

1.  Where is the documentation on CPLMalloc and related functions?
2.  Do CPLMalloc or GDAL provide for ease of access into image data
using 2-D indexing?
3.  Or should I be using the list-of-pointers method for 2-D indexing
as described in, say, Numerical Recipes?

Thanks,
Bruce

-- 
Bruce Raup
http://cires.colorado.edu/~braup/



More information about the Gdal-dev mailing list