<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1476" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=306072117-14102004>I recently switched 
my projection support from Proj4 to OGR and I'm having some issues when using 
the OGRCoordinateTransformation object.&nbsp; Basically, it looks like not all 
of my points are being transformed correctly when converting from one projection 
to the other.&nbsp; (ie. AEA to MERC).&nbsp; I check for errors when converting 
but no errors are being thrown.&nbsp; Basically my code looks like 
this:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=306072117-14102004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=306072117-14102004>OGRCoordinateTransformation* pCT = 
NULL;<BR>&nbsp;&nbsp;pCT = OGRCreateCoordinateTransformation(&amp;sourceSRS, 
&amp;targetSRS);<BR>&nbsp;&nbsp;if ((CPLGetLastErrorNo() != OGRERR_NONE) || 
(!pCT)) throw (char*) CPLGetLastErrorMsg();</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=306072117-14102004>&nbsp;&nbsp;if 
(pGeometry-&gt;GetGeometryTypeId() == 
VPWkbPolygon)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;CVPPtr&lt; IVPPolygon&gt; 
spPolygon = (IVPPolygon*) 
pGeometry;<BR>&nbsp;&nbsp;&nbsp;spPolygon-&gt;GetExteriorRing()-&gt;GetCoords(&amp;pXCoords, 
&amp;pYCoords);</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=306072117-14102004>&nbsp;&nbsp;&nbsp;vector&lt; double&gt;* pNewXCoords = 
new vector&lt; double&gt;(*pXCoords);<BR>&nbsp;&nbsp;&nbsp;vector&lt; 
double&gt;* pNewYCoords = new vector&lt; 
double&gt;(*pYCoords);<BR>&nbsp;&nbsp;&nbsp;if (pCT-&gt;Transform((int) 
pNewXCoords-&gt;size(), &amp;(*pNewXCoords)[0], 
&amp;(*pNewYCoords)[0]))<BR>&nbsp;&nbsp;&nbsp;&nbsp;((CVPLinearRing*)(spPolygon.p-&gt;GetExteriorRing()))-&gt;SetCoords(pNewXCoords, 
pNewYCoords);</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=306072117-14102004>&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; 
spPolygon-&gt;GetNumInteriorRing(); 
i++)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;spPolygon-&gt;GetInteriorRingN(i)-&gt;GetCoords(&amp;pXCoords, 
&amp;pYCoords);<BR>&nbsp;&nbsp;&nbsp;&nbsp;vector&lt; double&gt;* pNewXCoords = 
new vector&lt; double&gt;(*pXCoords);<BR>&nbsp;&nbsp;&nbsp;&nbsp;vector&lt; 
double&gt;* pNewYCoords = new vector&lt; 
double&gt;(*pYCoords);<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (pCT-&gt;Transform((int) 
pNewXCoords-&gt;size(), &amp;(*pNewXCoords)[0], 
&amp;(*pNewYCoords)[0]))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((CVPLinearRing*)(spPolygon.p-&gt;GetInteriorRingN(i)))-&gt;SetCoords(pNewXCoords, 
pNewYCoords);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=306072117-14102004>&nbsp;&nbsp;if (pCT) 
delete pCT;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=306072117-14102004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=306072117-14102004>I understand that 
some projections have valid lat/lon&nbsp;ranges that can be less than others 
(ie. Merc vs. latlong), should I not be passing points that are greater than a 
certain range?&nbsp; I was thinking that the proj library would wrap any 
longitudes if they needed wrapping.&nbsp; Is this a wrong assumption?&nbsp; Can 
anyone see what I'm doing wrong.&nbsp; I've attached a screen shot to show what 
the half/baked transform looks like when converting from AEA to MERC, and the 
.prj files I'm using for the projection info...I load them using 
importFromESRI().&nbsp; Also, I'm using GDAL 1.19.&nbsp; I know you're going to 
say upgrade...ok, I'll get on that.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=306072117-14102004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=306072117-14102004>Thanks for any 
help!</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=306072117-14102004></SPAN></FONT>&nbsp;</DIV>
<DIV align=left><FONT face=Arial size=2>
<DIV align=left><FONT face=Arial size=2>Martin Chapman</FONT></DIV>
<DIV align=left><FONT face=Arial><FONT size=2><SPAN 
class=812572720-02042003>Cell</SPAN>&nbsp;303-885-1936</FONT></FONT></DIV>
<DIV align=left><FONT face=Arial size=2><SPAN class=812572720-02042003>Office 
303-495-6300 x326</SPAN></FONT></DIV>
<DIV align=left><FONT face=Arial size=2><SPAN class=812572720-02042003><A 
href="mailto:mchapman@sanz.com">mchapman@sanz.com</A></SPAN></FONT></DIV>
<DIV align=left><FONT face=Arial size=2><SPAN class=812572720-02042003><A 
href="http://www.sanz.com/">http://www.sanz.com</A></SPAN></FONT></DIV></FONT></DIV>
<DIV align=left><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>