[gdal-dev] Coordinate Transformation problems

Christiaan Janssen cjanssen at iavo-rs.com
Mon Feb 25 10:53:51 EST 2008


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

Thanks for the help,

Christiaan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080225/3694cd28/attachment.html


More information about the gdal-dev mailing list