Skip to content

Commit

Permalink
Merge pull request #2838 from wonder-sk/fix-wgs-coords
Browse files Browse the repository at this point in the history
Fix precision of coordinate display for layer in non-projected CRS
  • Loading branch information
nyalldawson committed Feb 26, 2016
2 parents 76fcb1f + 8769abe commit a27dbf3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/qgscoordinateutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ int QgsCoordinateUtils::calculateCoordinatePrecision( double mapUnitsPerPixel, c
QString format = QgsProject::instance()->readEntry( "PositionPrecision", "/DegreeFormat", "MU" );
bool formatGeographic = ( format == "DM" || format == "DMS" || format == "D" );

// we can only calculate an automatic precision if both map CRS and format are geographic or both not geographic
if ( mapCrs.geographicFlag() == formatGeographic )
// we can only calculate an automatic precision if one of these is true:
// - both map CRS and format are geographic
// - both map CRS and format are not geographic
// - map CRS is geographic but format is not geographic (i.e. map units)
if ( mapCrs.geographicFlag() || !formatGeographic )
{
// Work out a suitable number of decimal places for the coordinates with the aim of always
// having enough decimal places to show the difference in position between adjacent pixels.
Expand Down

0 comments on commit a27dbf3

Please sign in to comment.