3

I am trying to change my resolution from 10m x10m raster cells to 25m x 25m raster cells. So far I figured that both gdalwarp and gdal_translate can do this (from python).

subprocess.call('gdal_translate -tr 25 25 -r bilinear ' + inputfile +' '+ outputfile, shell=True)
subprocess.call('gdalwarp -tr 25 25 -r bilinear ' + inputfile + ' ' + outputfile, shell=True)

However, I do run into 2 problems for both GDLA methods.

First problem: The output band rendering colors are shifted from hillshade to singleband grey. How can I fix this? I tried using gdaldem hillshade, but this did not work.

subprocess.call('gdal_translate -tr 25 25 -r bilinear ' + inputfile +' '+ outputfile, shell=True)
subprocess.call('gdaldem hillshade ' + outputfile + ' ' + outputfile +'_hillshade', shell=True)

My next problem is that the output file has extrapolated values outside of the original raster extent. See figure below.

Image of the 10m x10m resolution input raster 10m x10m resolution input raster

Image of the 25m x25m resolution output raster - The extent of the output raster is bigger than the input raster and the raster is shown in singleband grey. 25m x25m resolution output - Extent of the output raster is bigger than the input raster

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.