[gdal-dev] RasterIO decimation question ?

tle thanhvu.le at univ-pau.fr
Thu Mar 18 09:46:27 EDT 2010


Hi,

I'm writing a terrain visualization prototype and I'm using GDAL for reading
DEM data (GeoTif format without compressing and overview)
When the source and destination image dimension are different, I have
noticed a small translation of destination image to the left and bottom when
the dimension is getting smaller and smaller.
I have written a test program to find out what happened

This is an example of how i did :
Here is my source image with only 4x4 pixels :
0,0    1,0    2,0    3,0
0,1    1,1    2,1    3,1
0,2    1,2    2,2    3,2
0,3    1,3    2,3    3,3

By performing a rasterIO with destination dimension = 4, I got :
0,0    1,0    2,0    3,0
0,1    1,1    2,1    3,1
0,2    1,2    2,2    3,2
0,3    1,3    2,3    3,3
which is normal

Now I keep the same view and reduce the destination by haft (destination
dimension = 2), I got :
1,1    3,1
1,3    3,3

And with destination dimenstion = 1 :
2,2

Those results explain why my image is translating to right and bottom 
when reducing the destination size

I would like to know if it is because of decimation process (nearest
neighbor) ?
In this case the returned result should be like this :
For destination dimension = 2 :
0,0    2,0
0,2    2,2

And with destination dimension = 1 :
0,0

If it is not how it should work I would like to know where and how I could
make changes to keep the first line and column in the returned image ?
Should i inherit GDALRasterBand and make some changes in RasterIO function ?
It is important for my height field rendering application.

Best regards,

P/S : My test program is in C++, I could send it here if it is necessary

-- 
View this message in context: http://n2.nabble.com/RasterIO-decimation-question-tp4756535p4756535.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list