[Gdal-dev] Different projection results between gdalwarp and gdal python bindings

Frank Warmerdam warmerdam at pobox.com
Tue Aug 21 09:50:17 EDT 2007


Jose Luis Gomez Dans wrote:
> Hi, 
> I am finding some inconsistencies between the gdalwarp utility and the gdal Python bindings (old generation). The aim is to project a raster from UTM30N/ED50 to WGS84 (the projection WKTs are at the end of this message). Using gdalwarp (GDAL 1.4.2.0, released 2007/06/27) works fine, and I get reasonable results. If I then use gdal.CreateAndReprojectImage(), the image has a different GeoTransform. Here are the extents reported by gdalinfo:
...
> As you can see, there's a slight displacement. I am using exactly the same WKT string for the gdalwarp and the Python conversions, with explicity +towgs84 parameters. The gdalwarp command was simply:
> gdalwarp -s_srs utm30N_ED50_spain.wkt -t_srs wgs84.wkt input.tif output.tif
> 
> The Python code looks like this:
> g = gdal.OpenShared ("input.tif")
> error = gdal.CreateAndReprojectImage ( g, "output.tif", \
> 		src_wkt=utm30,	dst_wkt= wgs84 )
> 
> Any clues?

Jose,

I have reviewed the code used in gdalwarp, and in CreateAndReprojectImage()
and while their internal implementation is slightly different it isn't clear
to me why they would come up with different results.

I've tried reproducing your problem with FWTools 1.3.4 on linux but the
results match exactly.

I suspect some sort of subtle difference in the environment
variables or GDAL library version between the gdalwarp and
python case.

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