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

Frank Warmerdam warmerdam at pobox.com
Mon Feb 26 12:19:58 EST 2007


Jose Luis Gomez Dans wrote:
> Hi Frank, Thanks for your quick response
> 
> -------- Original-Nachricht --------
>> 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 gdalwarp.
>> 
> 
> I tried this, but the Create() method doesn't let me choose the raster
> limits or the resolution. The definition goes like this: def Create(self,
> filename, xsize, ysize, bands=1, datatype=GDT_Byte,               options =
> [])
> 
> While I can set the xsize and ysize, I would need to also set the extent of
> the window in the input file that will be considered. _gdal.Create() and
> friends don't let you do that (or am I wrong?).

Jose,

You would create the file with gdal.Create(), and then set the coordinate
system and geotransform the .SetProjection() and .SetGeotransform() methods.

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