[gdal-dev] Coordinate Transformation problems
Frank Warmerdam
warmerdam at pobox.com
Mon Feb 25 16:14:41 EST 2008
Christiaan Janssen wrote:
> I've been having a problem with coordinate transformation that I truely
> hope is a mistake on my part, if anyone can help it would be greatly
> appreciated. The issue is that when doing a translation from one system
> to another the z-component is not being transformed correctly (or at
> least not how I would expect it). The transformation is between two
> identical systems but with different linear units. I have attached a
> snippet of code the examples my problem:
>
> int err;
> double x, y, z;
> OGRCoordinateTransformation* ctTrans;
> OGRSpatialReference* srFeet = new OGRSpatialReference();
> OGRSpatialReference* srMeter = new OGRSpatialReference();
> srFeet->SetStatePlane(3200, 1, SRS_UL_US_FOOT,
> atof(SRS_UL_US_FOOT_CONV)); //NAD83 North Carolina
> srMeter->SetStatePlane(3200, 1, SRS_UL_METER, 1.0); //NAD83 North Carolina
> ctTrans = OGRCreateCoordinateTransformation(srFeet, srMeter);
> x = 618067.37752800086;
> y = 248532.06376793334;
> z = 1210.7631359994411;
> err = ctTrans->Transform(1, &x, &y, &z);
> //Results from function call
> //x = 188387.31344515912 <-Correct
> //y = 75752.724541875374 <-Correct
> //z = 1210.7631359994411 <-Unchanged and I therefore I think wrong
> //err = 1
Christiaan,
Can you explain what change you are expecting in Z and why?
PROJ.4 uses NAD27/NAD83 datum grid shift files to go from NAD27 to
NAD83, but this is strictly a 2D transformation. There is no Z component.
If, instead, we were using a 3/7 parameter towgs84= value to transform, the
opreration would be done in "geocentric space" and would also affect the
Z coordinate. But I doubt that would really be desirable in this case.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list