<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"OCR A Extended";
        panose-1:2 1 5 9 2 1 2 1 3 3;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"OCR A Extended";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"OCR A Extended";
color:#1F497D'>I must have been doing something like that. I got frustrated
and started from scratch and am now getting the correct results.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"OCR A Extended";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"OCR A Extended";
color:#1F497D'>Thank you guys help immensely. GDAL is great but the learning
curve is a bit steep at times.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"OCR A Extended";
color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
gdal-dev-bounces@lists.osgeo.org [mailto:gdal-dev-bounces@lists.osgeo.org] <b>On
Behalf Of </b>Belaid MOA<br>
<b>Sent:</b> Friday, July 31, 2009 4:04 PM<br>
<b>To:</b> gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> RE: [gdal-dev] Help understanding GDALApplyGeoTransform
andGDALInvGeoTransform<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;
font-family:"Verdana","sans-serif"'>Just out of curiosity, I ran your code on
my machine and I got exactly the same results as Even.<br>
I do not think that Endianity will cause such wrong results. Are you sure you
are not changing the values<br>
of new_x and new_y before printing them out?<br>
<br>
~Belaid.<br>
<br>
> From: even.rouault@mines-paris.org<br>
> To: gdal-dev@lists.osgeo.org<br>
> Subject: Re: [gdal-dev] Help understanding GDALApplyGeoTransform and
GDALInvGeoTransform<br>
> Date: Fri, 31 Jul 2009 20:20:46 +0200<br>
> CC: BCassanova@weather.com<br>
> <br>
> Bill,<br>
> <br>
> that's weird. Your code looks correct and I've just compiled it and I get
the <br>
> following results :<br>
> <br>
> lat-lon -127, 51<br>
> 7.24754e-13, 4.12115e-13<br>
> <br>
> The new_x, new_y values are almost 0 as expected (the small difference is
due <br>
> to numerical imprecision when computing the inverse geotransform).<br>
> <br>
> I can't understand why you get such wrong values.<br>
> <br>
> Le Friday 31 July 2009 19:56:39 Cassanova, Bill, vous avez écrit :<br>
> > double adfGeoTransform[6] = { -127, .011571482, 0, 51, 0, -.008993 };<br>
> ><br>
> > double adfReverseGeoTransform[6] = { 0, 0, 0, 0, 0, 0 };<br>
> ><br>
> > GDALInvGeoTransform( adfGeoTransform, adfReverseGeoTransform );<br>
> ><br>
> > double dfPixel = 0;<br>
> > double dfLine = 0;<br>
> > double x;<br>
> > double y;<br>
> ><br>
> > GDALApplyGeoTransform( adfGeoTransform, dfPixel, dfLine,
&x, &y );<br>
> ><br>
> > std::cout << "lat-lon " << x << ",
" << y << std::endl;<br>
> ><br>
> > double new_x;<br>
> > double new_y;<br>
> ><br>
> > GDALApplyGeoTransform( adfReverseGeoTransform, x, y,
&new_x, &new_y );<br>
> ><br>
> > std::cout << new_x << ", " << new_y
<< std::endl;<br>
> <br>
> <br>
> _______________________________________________<br>
> gdal-dev mailing list<br>
> gdal-dev@lists.osgeo.org<br>
> http://lists.osgeo.org/mailman/listinfo/gdal-dev<o:p></o:p></span></p>
<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>
<hr size=2 width="100%" align=center>
</span></div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>More
storage. Better anti-spam and antivirus protection. <a
href="http://go.microsoft.com/?linkid=9671352" target="_new">Hotmail makes it
simple.</a><o:p></o:p></span></p>
</div>
</body>
</html>