Skip to content
Permalink
Browse files
Fix for ticket #122 (projection set incorrectly for some raster
layers). The way that the raster layer sets it's srs is a bit complex
- hopefully these changes fix the problem without introducing other
problems (seems ok from the testing that I've done).


git-svn-id: http://svn.osgeo.org/qgis/trunk@5726 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Aug 23, 2006
1 parent fbf57e0 commit a1b9be058633f7bdb46ce9fe92da196df571a6bc
Showing with 20 additions and 4 deletions.
  1. +11 −2 src/gui/qgsspatialrefsys.cpp
  2. +9 −2 src/raster/qgsrasterlayer.cpp
@@ -173,9 +173,11 @@ void QgsSpatialRefSys::validate()
return;
}
}

QSettings mySettings;
QString myDefaultProjectionOption =
mySettings.readEntry("/Projections/defaultBehaviour");

if (myDefaultProjectionOption=="prompt")
{
//@note this class is not a descendent of QWidget so we cant pass
@@ -188,6 +190,8 @@ void QgsSpatialRefSys::validate()
if(mySelector->exec())
{
createFromSrsId(mySelector->getCurrentSRSID());
delete mySelector;
return;
}
else
{
@@ -200,10 +204,12 @@ void QgsSpatialRefSys::validate()
// XXX TODO: Change project to store selected CS as 'projectSRS' not 'selectedWKT'
mProj4String = QgsProject::instance()->readEntry("SpatialRefSys","//ProjectSRSProj4String",GEOPROJ4);
}
else ///Projections/defaultBehaviour==useDefault
else ///Projections/defaultBehaviour==useGlobal
{
// XXX TODO: Change global settings to store default CS as 'defaultSRS' not 'defaultProjectionWKT'
mProj4String = mySettings.readEntry("/Projections/defaultSRS",GEOPROJ4);
int srs_id = mySettings.readNumEntry("/Projections/defaultProjectionSRSID",GEOSRS_ID);
createFromSrsId(srs_id);
return;
}

//
@@ -222,7 +228,9 @@ void QgsSpatialRefSys::validate()
//default to proj 4..if all else fails we will use that for this srs
mProj4String = GEOPROJ4;
}

createFromProj4(mProj4String);

return;
}

@@ -460,6 +468,7 @@ bool QgsSpatialRefSys::createFromSrsId (long theSrsId)
mGeoFlag = (geo == 0 ? false : true);
setMapUnits();
mIsValidFlag = true;

}
else
{
@@ -88,7 +88,7 @@ wish to see edbug messages printed to stdout.
#include <QDomElement>
#include <QFrame>
#include <QPixmap>

#include <QSettings>
/*
*
* New includes that will convert this class to a data provider interface
@@ -690,8 +690,15 @@ QString QgsRasterLayer::getProjectionWKT()
{
//try to get the gcp srs from the raster layer if available
myWKTString=QString(gdalDataset->GetGCPProjection());
mySRS.createFromWkt(myWKTString);
if (!mySRS.isValid())
{
// set to default here?
QSettings settings;
int srsid = settings.readNumEntry("Projections/defaultProjectionSRSID", 4326);
mySRS.createFromId(srsid, QgsSpatialRefSys::QGIS_SRSID);
}
}


return myWKTString;
}

0 comments on commit a1b9be0

Please sign in to comment.