Hi,

I'm not getting the results I'm expecting using GDALCopy Words() and I was 
wondering if someone might have some insight into where I'm going wrong. I'm 
reading data from a raster block by block. I read the block data into an array. 
I'm calling GDALCopyWords() like this:

GDALCopyWords( srcBuffer, srcDataType, srcPixelIndex, &srcValue, GDT_Byte, 0, 1 
);

where:

srcBuffer is the array containing the block data
srcDataType is the data type from the raster band
srcPixelIndex is the offset from the start of srcBuffer of the pixel I'm 
interested in
srcValue is the value of the pixel

I'm reading a single pixel at a time, hence the dest pixel offset of 0 and word 
count of 1.

When I use GDALCopyWords() like this on an indexed image I find that each block 
seems to take on the value of the first pixel in the block. For example if the 
first pixel of the block is 128 then I get 128 for all other pixels in the 
block. 

If I index directly into my srcBuffer array then I get the expected values i.e.

if ( srcDataType == GDT_Byte )
{
    srcValue = srcBuffer[ srcPixelIndex ];
}

so I know that the correct data is in the buffer and that the calculations for 
srcPixelIndex are correct.

Regards,

Jo Meder


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to