Skip to content
Permalink
Browse files

When testing custom projections, show geographic results in degrees n…

…ot radians

Fixes #7036
  • Loading branch information
nyalldawson committed Nov 7, 2017
1 parent 2d9b573 commit f68e42900b8bb918b458274714461352f92d5848
Showing with 13 additions and 4 deletions.
  1. +13 −4 src/app/qgscustomprojectiondialog.cpp
@@ -581,7 +581,7 @@ void QgsCustomProjectionDialog::pbnCalculate_clicked()
// Get the WGS84 coordinates
bool okN, okE;
double northing = northWGS84->text().toDouble( &okN ) * DEG_TO_RAD;
double easthing = eastWGS84->text().toDouble( &okE ) * DEG_TO_RAD;
double easting = eastWGS84->text().toDouble( &okE ) * DEG_TO_RAD;

if ( !okN || !okE )
{
@@ -609,7 +609,7 @@ void QgsCustomProjectionDialog::pbnCalculate_clicked()

double z = 0.0;

int projResult = pj_transform( wgs84Proj, proj, 1, 0, &easthing, &northing, &z );
int projResult = pj_transform( wgs84Proj, proj, 1, 0, &easting, &northing, &z );
if ( projResult != 0 )
{
projectedX->setText( tr( "Error" ) );
@@ -620,9 +620,18 @@ void QgsCustomProjectionDialog::pbnCalculate_clicked()
{
QString tmp;

tmp = QLocale::system().toString( northing, 'f', 4 );
int precision = 4;

if ( pj_is_latlong( proj ) )
{
northing *= RAD_TO_DEG;
easting *= RAD_TO_DEG;
precision = 7;
}

tmp = QLocale::system().toString( northing, 'f', precision );
projectedX->setText( tmp );
tmp = QLocale::system().toString( easthing, 'f', 4 );
tmp = QLocale::system().toString( easting, 'f', precision );
projectedY->setText( tmp );
}

0 comments on commit f68e429

Please sign in to comment.
You can’t perform that action at this time.