Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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@4808 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Feb 7, 2006
1 parent cd60c49 commit e999186
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/core/qgsdistancearea.cpp
Expand Up @@ -55,12 +55,16 @@ void QgsDistanceArea::setSourceSRS(long srsid)

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

int srsid = QgsProject::instance()->readNumEntry("SpatialRefSys","/ProjectSRSID",GEOSRS_ID);
0
setSourceSRS(srsid);
}

Expand Down

0 comments on commit e999186

Please sign in to comment.