[Gdal-dev] Warping and resampling with gdal in python

Frank Warmerdam warmerdam at pobox.com
Mon Feb 26 10:40:12 EST 2007

Jose Luis Gomez Dans wrote:
> Hi! I am trying to reproject, resample and subset some files using a Python
> script. I have noticed that the gdal.py module has some utility members to
> accomplish this. To achieve this, I have simply used
> err = gdal.CreateAndReprojectImage( g_in, f_out, src_wkt = src_wkt, dst_wkt
> = dst_wkt)
> where g_in, f_out and the src and dst wkt have been defined elsewhere. This
> works well, but ideally, I would like to be able to set the output
> resolution, and to also subset the original data. While I can do this with
> VRTs (I think :D), I was wondering what the "official best" :) approach to
> this is.


You can also create the output file yourself with whatever extents and
resolution you want, and then use gdal.ReprojectImage() instead of
gdal.CreateAndReprojectImage().  If that doesn't give you the control
you need, you are basically looking at using VRTs or shelling out to

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list