[FWTools] Problem with SouthAfrican projections ex Lo29

Darko Radiceski radiceski at gmail.com
Mon Feb 7 07:56:29 EST 2011


Following the email i did a bit more testing with this and added calls to


theErrNum = CPLGetLastErrorNo();

eErr = CPLGetLastErrorType();



and they turn up to be:

6

and

CE_Failure

Any idea what i am doing wrong?

On Mon, Feb 7, 2011 at 6:41 PM, Darko Radiceski <radiceski at gmail.com> wrote:

> Hi all,
>
> I have been having some issues when i try and create a
> CoordinateTransform object from project from SouthAfrican projection
> Lo29 to EPSG. I have the following code:
>
> int LIOinput_CoordinateTransform_Build(int source_EPSGcode, int
> target_EPSGcode, LIO_CoordinateTransform *pt_CT)
> {       int rc=FALSE;
>
>        if(pt_CT)
>        {
>                // init
>                LIOinput_CoordinateTransform_Init(pt_CT);
>
>                // allocate
>                pt_CT->hSR[LIO_SOURCE] = OSRNewSpatialReference(NULL);
>                pt_CT->hSR[LIO_TARGET] = OSRNewSpatialReference(NULL);
>
>                if(pt_CT->hSR[LIO_SOURCE] && pt_CT->hSR[LIO_TARGET])
>                {
>                        if(OSRImportFromEPSG(pt_CT->hSR[LIO_SOURCE],
> source_EPSGcode) ==
> OGRERR_NONE)  //2053
>                        {
>                                if(OSRImportFromEPSG(pt_CT->hSR[LIO_TARGET],
> target_EPSGcode) ==
> OGRERR_NONE)
>                                {
>                                        if(target_EPSGcode == 4326) /* ==
> WGS84 */
>
>  OSRSetAngularUnits(pt_CT->hSR[LIO_TARGET], SRS_UA_RADIAN, 1.0);
>                                        else
>                                        {       if(source_EPSGcode == 4326)
>
>  OSRSetAngularUnits(pt_CT->hSR[LIO_SOURCE], SRS_UA_RADIAN, 1.0);
>                                        }
>
>                                        // build
>                                        if((pt_CT->hCT =
> OCTNewCoordinateTransformation(pt_CT->hSR[LIO_SOURCE],
> pt_CT->hSR[LIO_TARGET])))
>                                        {
>                                                if((pt_CT->hGeom =
> OGR_G_CreateGeometry(wkbPoint25D)))
>                                                {
>
>  pt_CT->EPSGcode[LIO_SOURCE] = source_EPSGcode;
>
>  pt_CT->EPSGcode[LIO_TARGET] = target_EPSGcode;
>
>                                                        // success!
>                                                        rc = TRUE;
>                                                }
>                                        }
>                                }
>                        }
>                }
>
>                // fail --> clean up
>                if(!rc)
>                        LIOinput_CoordinateTransform_Clean(pt_CT);
>        }
>
>        return(rc);
> }
>
> The call to: OCTNewCoordinateTransformation always fails.
>
> I have downloaded the latest proj4 files and and recompiled it. I also
> have the latest EPSG file that has the definition of Lo29 - 2053
>
> Any advice of what i could be doing wrong?
>
> Cheers
> Dan
>
> --
> Dan
> University of Wollongong
> Australia
> SIFE - UOW Chapter - Alumni
>



-- 
Radiceski Darko
University of Wollongong
Australia
SIFE - UOW Chapter - Alumni
CASUAL ACADEMIC STAFF TEACHING - UOW SITACS
(School of Information Technology and Computer Science,University of
Wollongong)
Univeristy of Wollongong - Alumni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20110207/5eabe598/attachment.htm 


More information about the FWTools mailing list