[FWTools] Problem with SouthAfrican projections ex Lo29

Darko Radiceski radiceski at gmail.com
Mon Feb 7 02:41:50 EST 2011


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


More information about the FWTools mailing list