[gdal-dev] Gdal_warp -r sum not working a expected

Ainslie Johnstone johnstone.ainslie at gmail.com
Fri Jul 1 10:53:25 PDT 2022


Hi there, 

I am trying to downsample a high-resolution file of gridded population estimates (1km res over the whole world). I want the downsampled version to give the total population in the new lower-resolution grid. However, whenever I downsample using gdalwarp -r sum, I don’t seem to be getting this. Instead the new values in the lower-resolution grid (no matter what resolution it is) seem to be more like the max, rather than the sum, of the old high-resolution grid. If I add up the total population across the whole grid it is far lower than it should be. How much lower depends on how much I have downsampled. 

I am making sure to exclude the no data values, and have tried a whole variety of different output resolutions and projections. Any suggestions as to why this might be? 

Thanks in advance for your help! 
Ainslie


More information about the gdal-dev mailing list