How to change raster resolution using GDAL?

I am looking for a better way to change the resolution of a GDAL raster dataset.

For example, I have a raster pixel size (30, -30), and I would like to change the pixel size to (5, -5), interpolating all the values ​​for this pixel into the output raster file.

So, for each pixel of the input raster, I would like to have 36 pixels in the output raster, they all have the same value.

If I run gdalwarp -tr 5 -5 inputRaster.tif outputRaster.tif , I get exactly the result I'm looking for, and so I would suggest that I should be able to replicate this function using some GDAL function.

I would prefer not to use the python Subprocess class call if possible.

+7
source share
1 answer

You need to reprogram the raster. For example, from the Python interactive shell:

 from osgeo import gdal help(gdal.ReprojectImage) 

A Python example is provided in a test suite.

More complete documentation is provided for the C ++ function GDALReprojectImage .

+7
source

All Articles