[gdal-dev] Accessing a 2D array stored in 1D by GDALRasterIO()

Even Rouault even.rouault at mines-paris.org
Thu Dec 12 03:42:41 PST 2013


Selon Yann Chemin <ychemin at gmail.com>:

> Hi,
>
> I loaded an image with:
> GDALRasterIO(hB,GF_Read,0,0,nX,nY,oneDarray,nX,nY,GDT_Float32,0,0);
>
> to run some statistics, however, a new requirement is to make stats per
> land-use,
>
> is there a way to get the index of a given pixel in the 1D array from a
> given set of row & column?

OneDaarry[row * nXSize + col] where OneDarray is a float* (to match GDT_Float32)
and nXSize = GDALGetRasterBandXSize(hB)


>
> Thank you,
> Yann
>
>
> --
> ----
>




More information about the gdal-dev mailing list