<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        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";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.emailstyle17
        {font-family:Arial;
        color:windowtext;}
span.EmailStyle18
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Mystery solved &#8211; at least the
initial part &#8211; My GDAL / OGR build does not have Proj4 included as a
static library and I did not have the DLL in the execution path.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Is there a way to query OGR to get an
error message or code that explains why an operation fails?</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Bruce</span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> gdal-dev-bounces@lists.osgeo.org
[mailto:gdal-dev-bounces@lists.osgeo.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Clay, Bruce<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, March 12, 2008
5:33 PM<br>
<b><span style='font-weight:bold'>To:</span></b> gdal-dev@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [gdal-dev] Create
Coordinate Transformation always returns NULL</span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am trying to create a transformation from WGS 84 to a
projected&nbsp; system. &nbsp;I have tried several but create transform always
returns NULL.</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>The code I am using is essentially the reverse sequence as
shown in the OSR tutorial. &nbsp;That is that the example went from a projected
frame to a geodetic frame.</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>The returned status for each of the steps is 0 so it looks
like everything should work and this type of transform is fairly common so I
would think it should be supported by proj4 but I don&#8217;t see anything in
the proj4 docs that describe what types are supported.</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Any ideas would be greatly appreciated</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Bruce</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span Courier><span style='font-size:10.0pt;font-family:
"Courier New";color:green'>///////////////////////////////////////////////////////////////////////////////</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>OGRCoordinateTransformation
*GdalWrapper::CreateWellKnownTransformation(</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>const</span></font> <font color=blue><span
style='color:blue'>char</span></font> *srcWngcsSrs, <font color=blue><span
style='color:blue'>const</span></font> <font color=blue><span style='color:
blue'>char</span></font> *destWngcsSrs)</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>{</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>int</span></font> status = -1;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
OGRErr ogrStatus;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
OGRCoordinateTransformation *coordTransPtr = NULL;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
OGRSpatialReference srcSpatialRef;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
OGRSpatialReference destSpatialRef;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ogrStatus = srcSpatialRef.SetWellKnownGeogCS(<font color=maroon><span
style='color:maroon'>&quot;WGS84&quot;</span></font>);</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>if</span></font> (ogrStatus == 0)</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ogrStatus = destSpatialRef.SetProjCS(<font color=maroon><span style='color:
maroon'>&quot;UTM 17 / WGS84&quot;</span></font> );</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ogrStatus = destSpatialRef.SetWellKnownGeogCS( <font color=maroon><span
style='color:maroon'>&quot;WGS84&quot;</span></font> );</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ogrStatus = destSpatialRef.SetUTM( 17, TRUE );</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>if</span></font> (ogrStatus == 0)</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
coordTransPtr = OGRCreateCoordinateTransformation(</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&amp;srcSpatialRef, &amp;destSpatialRef);</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>return</span></font>(coordTransPtr);</span></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
Courier><span style='font-size:10.0pt;font-family:"Courier New"'>}</span></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

</div>

</body>

</html>
<pre>

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.</pre>

<pre>

This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.</pre>