Skip to content

Commit 7c40854

Browse files
author
g_j_m
committedFeb 7, 2006
Obtain the correct SRS even when on-the-fly projection is disabled.
Fixes bug with areas and line measurements being wrong in some cases git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4808 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed
 

‎src/core/qgsdistancearea.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@ void QgsDistanceArea::setSourceSRS(long srsid)
5555

5656
void QgsDistanceArea::setProjectAsSourceSRS()
5757
{
58-
int projEnabled = QgsProject::instance()->readNumEntry("SpatialRefSys","/ProjectionsEnabled",0);
59-
long srsid = GEOSRS_ID;
60-
if (projEnabled)
61-
{
62-
srsid = QgsProject::instance()->readNumEntry("SpatialRefSys","/ProjectSRSID",GEOSRS_ID);
63-
}
58+
// This function used to only get the /ProjectSRSID if on-the-fly
59+
// projection was enabled (and used a default value in all other
60+
// cases). However, even if it was not, a valid value for
61+
// /ProjectSRSID is most likely available, and we now use it in all
62+
// cases (as it gives correct distances and areas even when
63+
// on-the-fly projection is turned off). The default of GEOSRS_ID
64+
// is still applied if all else fails.
65+
66+
int srsid = QgsProject::instance()->readNumEntry("SpatialRefSys","/ProjectSRSID",GEOSRS_ID);
67+
0
6468
setSourceSRS(srsid);
6569
}
6670

0 commit comments

Comments
 (0)
Please sign in to comment.