[gdal-dev] gdalwarp "-r mode" algorithm bug
Jin Katagi
kemisknkn37 at gmail.com
Tue Mar 8 07:17:05 PST 2016
Hi,
I tried to translate picture's resolution from 10mx10m to 50mx50m using
"gdalwarp" command and got the problem.
I used it with "-r mode" like this.
$ gdalwarp -t_srs EPSG:4326 -tr 0.000416667 0.000416667 -r mode
original.tif resize.tif
I thought that "-r mode" resamples specified resolution (in this case, 5x5
pixel), but the outcome was very strange.
So I made a test script and checked.
(The square that is surrounded (row,col)=(25,25)(74,74) is value 1,and
others is value 0,100x100 pixel.)
This is the test script using GRASS(7.0.3).
# set the resolution 100mx100m and a size is 100x100
$ g.region w=140 e=140.0083 s=36 n=36.0083 res=8.333333333333333e-05
$ r.mapcalc " dummy =
if(row()>25,if(row()<75,if(col()>25,if(col()<75,1),0),0),0) "
$ r.out.gdal input=dummy output=original.tif
# And checked.
$ gdalwarp -t_srs EPSG:4326 -tr 0.000416667 0.000416667 -r mode
original.tif resize.tif
On the original.tif,the square that is surrounded (row,col)=(70,70),(75,75)
account for 15/25 value 1, but the resize.tif the square that is surrounded
(row,col)=(14,14),(15,15) is value 0.
Is this the problem of the mode algorithm?
The gdal version I used is 1.11.2 and OS is Ubuntu 14.04.
Thank you for your replies.
Katagi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160309/91a78125/attachment.html>
More information about the gdal-dev
mailing list