I am resampling a raster from ~500m to ~1km in using two different methods: max and average. However, both results are the exact same and not what I'd expect for either.

gdalwarp -ot Byte -tr 926.625432000000046 926.625432000000046 -r max input.tif output-max.tif

gdalwarp -ot Byte -tr 926.625432000000046 926.625432000000046 -r average input.tif output-ave.tif

input.tif is a raster consisting of 0's, 100's, and NoData. Its resolution is 463.312716000000023, exactly half of the output resolution. Therefore I would expect the results of the max resampling to be 0 or 100, and the results of the average resampling to be 0, 25, 50, 75, or 100. However both results are the exact same with values of 0, 25, 33, 50, 67, 75, 100. This is not at all what I would expect. To the naked eye at least the pixels do match up (i.e. four input pixels fit perfectly inside one output pixel) so I'm not seeing any reason for this behavior. Any ideas?

  • Can you share some test data? – user30184 Mar 23 '18 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.