Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Applied patch from Jean-Claude Repetto for ticket #719 Problem with N…
…TF projection in ECW files

git-svn-id: http://svn.osgeo.org/qgis/trunk@7689 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Nov 30, 2007
1 parent b54012c commit dd10527
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/core/qgsspatialrefsys.cpp
Expand Up @@ -488,10 +488,13 @@ bool QgsSpatialRefSys::createFromProj4 (const QString theProj4String)
{

//
// Example:
// Examples:
// +proj=tmerc +lat_0=0 +lon_0=-62 +k=0.999500 +x_0=400000 +y_0=0
// +ellps=clrk80 +towgs84=-255,-15,71,0,0,0,0 +units=m +no_defs
//
// +proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=2.337229166666664 +k_0=0.99987742
// +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515.000000472 +units=m +no_defs
//
mIsValidFlag=false;

QRegExp myProjRegExp( "\\+proj=\\S+" );
Expand All @@ -514,17 +517,22 @@ bool QgsSpatialRefSys::createFromProj4 (const QString theProj4String)
myStart= 0;
myLength=0;
myStart = myEllipseRegExp.search(theProj4String, myStart);
if (myStart==-1)
if (myStart!=-1)
{
QgsLogger::warning("QgsSpatialRefSys::createFromProj4 error proj string supplied has no +ellps argument");

return mIsValidFlag;
myLength = myEllipseRegExp.matchedLength();
mEllipsoidAcronym = theProj4String.mid(myStart+ELLPS_PREFIX_LEN,myLength-ELLPS_PREFIX_LEN);
}
else

QRegExp myAxisRegExp( "\\+a=\\S+" );
myStart= 0;
myLength=0;
myStart = myAxisRegExp.search(theProj4String, myStart);
if (myStart==-1 && mEllipsoidAcronym.isNull())
{
myLength = myEllipseRegExp.matchedLength();
QgsLogger::warning("QgsSpatialRefSys::createFromProj4 error proj string supplied has no +ellps or +a argument");

return mIsValidFlag;
}
mEllipsoidAcronym = theProj4String.mid(myStart+ELLPS_PREFIX_LEN,myLength-ELLPS_PREFIX_LEN);
//mproj4string must be set here for the rest of this method to behave in a meaningful way...
mProj4String = theProj4String;

Expand Down

0 comments on commit dd10527

Please sign in to comment.