[gdal-dev] Help understanding GDALApplyGeoTransform
andGDALInvGeoTransform
Cassanova, Bill
BCassanova at weather.com
Fri Jul 31 16:11:47 EDT 2009
I must have been doing something like that. I got frustrated and started from scratch and am now getting the correct results.
Thank you guys help immensely. GDAL is great but the learning curve is a bit steep at times.
From: gdal-dev-bounces at lists.osgeo.org [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Belaid MOA
Sent: Friday, July 31, 2009 4:04 PM
To: gdal-dev at lists.osgeo.org
Subject: RE: [gdal-dev] Help understanding GDALApplyGeoTransform andGDALInvGeoTransform
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=9671352>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090731/1e5e098c/attachment.html
More information about the gdal-dev
mailing list