<!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. Basically, it looks like not all
of my points are being transformed correctly when converting from one projection
to the other. (ie. AEA to MERC). I check for errors when converting
but no errors are being thrown. Basically my code looks like
this:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=306072117-14102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=306072117-14102004>OGRCoordinateTransformation* pCT =
NULL;<BR> pCT = OGRCreateCoordinateTransformation(&sourceSRS,
&targetSRS);<BR> if ((CPLGetLastErrorNo() != OGRERR_NONE) ||
(!pCT)) throw (char*) CPLGetLastErrorMsg();</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=306072117-14102004> if
(pGeometry->GetGeometryTypeId() ==
VPWkbPolygon)<BR> {<BR> CVPPtr< IVPPolygon>
spPolygon = (IVPPolygon*)
pGeometry;<BR> spPolygon->GetExteriorRing()->GetCoords(&pXCoords,
&pYCoords);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=306072117-14102004> vector< double>* pNewXCoords =
new vector< double>(*pXCoords);<BR> vector<
double>* pNewYCoords = new vector<
double>(*pYCoords);<BR> if (pCT->Transform((int)
pNewXCoords->size(), &(*pNewXCoords)[0],
&(*pNewYCoords)[0]))<BR> ((CVPLinearRing*)(spPolygon.p->GetExteriorRing()))->SetCoords(pNewXCoords,
pNewYCoords);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=306072117-14102004> for (int i = 0; i <
spPolygon->GetNumInteriorRing();
i++)<BR> {<BR> spPolygon->GetInteriorRingN(i)->GetCoords(&pXCoords,
&pYCoords);<BR> vector< double>* pNewXCoords =
new vector< double>(*pXCoords);<BR> vector<
double>* pNewYCoords = new vector<
double>(*pYCoords);<BR> if (pCT->Transform((int)
pNewXCoords->size(), &(*pNewXCoords)[0],
&(*pNewYCoords)[0]))<BR> ((CVPLinearRing*)(spPolygon.p->GetInteriorRingN(i)))->SetCoords(pNewXCoords,
pNewYCoords);<BR> }<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=306072117-14102004> if (pCT)
delete pCT;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=306072117-14102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=306072117-14102004>I understand that
some projections have valid lat/lon ranges that can be less than others
(ie. Merc vs. latlong), should I not be passing points that are greater than a
certain range? I was thinking that the proj library would wrap any
longitudes if they needed wrapping. Is this a wrong assumption? Can
anyone see what I'm doing wrong. 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(). Also, I'm using GDAL 1.19. 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> </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> </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> 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> </DIV>
<DIV> </DIV></BODY></HTML>