[gdal-dev] problems with gdal_translate

Oz Nahum nahumoz at gmail.com
Fri Sep 18 12:49:11 EDT 2009

Hi Jean-Claude,
Thanks for your answer !

I would like still to find some things which are not clear to me. Any help
would be appreciated.

Since the horizontal resolution is 1483m/pixel and the vertical resolution
> is 1391m/pixel, it is obvious that your cells are not square !

Hi Jean,
Thanks for your message. Well if that's the case then the error notice in
the code should be changed, imho.
Since the error says:

       "of CELLSIZE since the input pixels are non-square.

But the pixels them selves are square ! Just the whole tiff itself has a non
square resolution.

    adfGeoTransform[0] /* top left x */
    adfGeoTransform[1] /* w-e pixel resolution */
    adfGeoTransform[2] /* rotation, 0 if image is "north up" */
    adfGeoTransform[3] /* top left y */
    adfGeoTransform[4] /* rotation, 0 if image is "north up" */
    adfGeoTransform[5] /* n-s pixel resolution */

following the python api tutorial here http://www.gdal.org/gdal_tutorial.html
I understood that my pixel size is 1 by 1.
So the differnce is:
 the C++ is looking at the X-Y resolution and call is pixel size ?
Whereas in the python tutorial, called this the ,dataSource.RasterXSize ,

>>> dataSource = gdal.Open('area_of_interest.tif')
>>> geotransform = dataSource.GetGeoTransform()
>>> print 'Pixel Size = (',geotransform[1], ',',geotransform[5],')'
Pixel Size = ( 1.0 , -1.0 )
>>> print 'Origin = (',geotransform[0], ',',geotransform[3],')'
Origin = ( 3366307.0 , 5814845.0 )
>>> print 'Size is ',dataSource.RasterXSize,'x',dataSource.RasterYSize,
Size is  1483 x 1391 x 1

Also, one more thing I noticed,
when I convert the tiff to resized tiff, this error is not raised !

Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen


Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090918/8fb7e46e/attachment.html

More information about the gdal-dev mailing list