[gdal-dev] Help understanding GDALApplyGeoTransform and GDALInvGeoTransform

Belaid MOA belaid_moa at hotmail.com
Fri Jul 31 16:04:23 EDT 2009


Just out of curiosity, I ran your code on my machine and I got exactly the same results as Even.
I do not think that Endianity will cause such wrong results. Are you sure you are not changing the values
of new_x and new_y before printing them out?

~Belaid.

> From: even.rouault at mines-paris.org
> To: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] Help understanding GDALApplyGeoTransform and	GDALInvGeoTransform
> Date: Fri, 31 Jul 2009 20:20:46 +0200
> CC: BCassanova at weather.com
> 
> Bill,
> 
> that's weird. Your code looks correct and I've just compiled it and I get the 
> following results :
> 
> lat-lon -127, 51
> 7.24754e-13, 4.12115e-13
> 
> The new_x, new_y values are almost 0 as expected (the small difference is due 
> to numerical imprecision when computing the inverse geotransform).
> 
> I can't understand why you get such wrong values.
> 
> Le Friday 31 July 2009 19:56:39 Cassanova, Bill, vous avez écrit :
> > double adfGeoTransform[6] = { -127, .011571482, 0, 51, 0, -.008993 };
> >
> > double adfReverseGeoTransform[6] = { 0, 0, 0, 0, 0, 0 };
> >
> > GDALInvGeoTransform( adfGeoTransform, adfReverseGeoTransform );
> >
> > double dfPixel = 0;
> > double dfLine = 0;
> > double x;
> > double y;
> >
> > GDALApplyGeoTransform(   adfGeoTransform, dfPixel, dfLine, &x, &y );
> >
> > std::cout << "lat-lon " << x << ", " << y << std::endl;
> >
> > double new_x;
> > double new_y;
> >
> > GDALApplyGeoTransform(   adfReverseGeoTransform, x, y, &new_x, &new_y );
> >
> > std::cout << new_x << ", " << new_y << std::endl;
> 
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

_________________________________________________________________
More storage. Better anti-spam and antivirus protection. Hotmail makes it simple.
http://go.microsoft.com/?linkid=9671357
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090731/bc03c663/attachment.html


More information about the gdal-dev mailing list