<div>Following the email i did a bit more testing with this and added calls to </div>
<div> </div>
<div><font size="2">
<p>theErrNum = CPLGetLastErrorNo();</p>
<p>eErr = CPLGetLastErrorType();</p>
<p> </p>
<p>and they turn up to be: </p>
<p>6 </p>
<p>and </p>
<p>CE_Failure</p>
<p>Any idea what i am doing wrong?</p></font></div>
<div> </div>
<div>On Mon, Feb 7, 2011 at 6:41 PM, Darko Radiceski <span dir="ltr"><<a href="mailto:radiceski@gmail.com">radiceski@gmail.com</a>></span> wrote:<br></div>
<div class="gmail_quote">
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi all,<br><br>I have been having some issues when i try and create a<br>CoordinateTransform object from project from SouthAfrican projection<br>
Lo29 to EPSG. I have the following code:<br><br>int LIOinput_CoordinateTransform_Build(int source_EPSGcode, int<br>target_EPSGcode, LIO_CoordinateTransform *pt_CT)<br>{ int rc=FALSE;<br><br> if(pt_CT)<br> {<br>
// init<br> LIOinput_CoordinateTransform_Init(pt_CT);<br><br> // allocate<br> pt_CT->hSR[LIO_SOURCE] = OSRNewSpatialReference(NULL);<br> pt_CT->hSR[LIO_TARGET] = OSRNewSpatialReference(NULL);<br>
<br> if(pt_CT->hSR[LIO_SOURCE] && pt_CT->hSR[LIO_TARGET])<br> {<br> if(OSRImportFromEPSG(pt_CT->hSR[LIO_SOURCE], source_EPSGcode) ==<br>OGRERR_NONE) //2053<br>
{<br> if(OSRImportFromEPSG(pt_CT->hSR[LIO_TARGET], target_EPSGcode) ==<br>OGRERR_NONE)<br> {<br> if(target_EPSGcode == 4326) /* == WGS84 */<br>
OSRSetAngularUnits(pt_CT->hSR[LIO_TARGET], SRS_UA_RADIAN, 1.0);<br> else<br> { if(source_EPSGcode == 4326)<br>
OSRSetAngularUnits(pt_CT->hSR[LIO_SOURCE], SRS_UA_RADIAN, 1.0);<br> }<br><br> // build<br>
if((pt_CT->hCT =<br>OCTNewCoordinateTransformation(pt_CT->hSR[LIO_SOURCE],<br>pt_CT->hSR[LIO_TARGET])))<br> {<br> if((pt_CT->hGeom = OGR_G_CreateGeometry(wkbPoint25D)))<br>
{<br> pt_CT->EPSGcode[LIO_SOURCE] = source_EPSGcode;<br> pt_CT->EPSGcode[LIO_TARGET] = target_EPSGcode;<br>
<br> // success!<br> rc = TRUE;<br> }<br> }<br>
}<br> }<br> }<br><br> // fail --> clean up<br> if(!rc)<br> LIOinput_CoordinateTransform_Clean(pt_CT);<br>
}<br><br> return(rc);<br>}<br><br>The call to: OCTNewCoordinateTransformation always fails.<br><br>I have downloaded the latest proj4 files and and recompiled it. I also<br>have the latest EPSG file that has the definition of Lo29 - 2053<br>
<br>Any advice of what i could be doing wrong?<br><br>Cheers<br>Dan<br><font color="#888888"><br>--<br>Dan<br>University of Wollongong<br>Australia<br>SIFE - UOW Chapter - Alumni<br></font></blockquote></div><br><br clear="all">
<br>-- <br>Radiceski Darko<br>University of Wollongong<br>Australia<br>SIFE - UOW Chapter - Alumni<br>CASUAL ACADEMIC STAFF TEACHING - UOW SITACS<br>(School of Information Technology and Computer Science,University of Wollongong)<br>
Univeristy of Wollongong - Alumni<br>