Skip to content

Commit

Permalink
Merge pull request #3244 from rouault/fix_transformCoords
Browse files Browse the repository at this point in the history
QgsCoordinateTransform::transformCoords(): do not convert elevations to radians
  • Loading branch information
rouault committed Jun 28, 2016
2 parents f0e0ba5 + 83683be commit 45a4ae2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/core/qgscoordinatetransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ void QgsCoordinateTransform::transformCoords( int numPoints, double *x, double *
{
x[i] *= DEG_TO_RAD;
y[i] *= DEG_TO_RAD;
z[i] *= DEG_TO_RAD;
}

}
Expand Down Expand Up @@ -736,7 +735,6 @@ void QgsCoordinateTransform::transformCoords( int numPoints, double *x, double *
{
x[i] *= RAD_TO_DEG;
y[i] *= RAD_TO_DEG;
z[i] *= RAD_TO_DEG;
}
}
#ifdef COORDINATE_TRANSFORM_VERBOSE
Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ void TestQgsGeometry::pointV2()
p16.transform( tr, QgsCoordinateTransform::ForwardTransform );
QVERIFY( qgsDoubleNear( p16.x(), 175.771, 0.001 ) );
QVERIFY( qgsDoubleNear( p16.y(), -39.722, 0.001 ) );
QVERIFY( qgsDoubleNear( p16.z(), 57.2958, 0.001 ) );
QVERIFY( qgsDoubleNear( p16.z(), 1.0, 0.001 ) );
QCOMPARE( p16.m(), 2.0 );
p16.transform( tr, QgsCoordinateTransform::ReverseTransform );
QVERIFY( qgsDoubleNear( p16.x(), 6374985, 1 ) );
Expand Down Expand Up @@ -1491,11 +1491,11 @@ void TestQgsGeometry::lineStringV2()
l22.transform( tr, QgsCoordinateTransform::ForwardTransform );
QVERIFY( qgsDoubleNear( l22.pointN( 0 ).x(), 175.771, 0.001 ) );
QVERIFY( qgsDoubleNear( l22.pointN( 0 ).y(), -39.722, 0.001 ) );
QVERIFY( qgsDoubleNear( l22.pointN( 0 ).z(), 57.2958, 0.001 ) );
QVERIFY( qgsDoubleNear( l22.pointN( 0 ).z(), 1.0, 0.001 ) );
QCOMPARE( l22.pointN( 0 ).m(), 2.0 );
QVERIFY( qgsDoubleNear( l22.pointN( 1 ).x(), 176.959, 0.001 ) );
QVERIFY( qgsDoubleNear( l22.pointN( 1 ).y(), -38.798, 0.001 ) );
QVERIFY( qgsDoubleNear( l22.pointN( 1 ).z(), 171.887, 0.001 ) );
QVERIFY( qgsDoubleNear( l22.pointN( 1 ).z(), 3.0, 0.001 ) );
QCOMPARE( l22.pointN( 1 ).m(), 4.0 );

//reverse transform
Expand Down

0 comments on commit 45a4ae2

Please sign in to comment.