Skip to content

Commit a6d79b2

Browse files
author
timlinux
committedNov 30, 2007
Applied patch from Jean-Claude Repetto for ticket #719 Problem with NTF projection in ECW files
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7689 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed
 

‎src/core/qgsspatialrefsys.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,13 @@ bool QgsSpatialRefSys::createFromProj4 (const QString theProj4String)
488488
{
489489

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

497500
QRegExp myProjRegExp( "\\+proj=\\S+" );
@@ -514,17 +517,22 @@ bool QgsSpatialRefSys::createFromProj4 (const QString theProj4String)
514517
myStart= 0;
515518
myLength=0;
516519
myStart = myEllipseRegExp.search(theProj4String, myStart);
517-
if (myStart==-1)
520+
if (myStart!=-1)
518521
{
519-
QgsLogger::warning("QgsSpatialRefSys::createFromProj4 error proj string supplied has no +ellps argument");
520-
521-
return mIsValidFlag;
522+
myLength = myEllipseRegExp.matchedLength();
523+
mEllipsoidAcronym = theProj4String.mid(myStart+ELLPS_PREFIX_LEN,myLength-ELLPS_PREFIX_LEN);
522524
}
523-
else
525+
526+
QRegExp myAxisRegExp( "\\+a=\\S+" );
527+
myStart= 0;
528+
myLength=0;
529+
myStart = myAxisRegExp.search(theProj4String, myStart);
530+
if (myStart==-1 && mEllipsoidAcronym.isNull())
524531
{
525-
myLength = myEllipseRegExp.matchedLength();
532+
QgsLogger::warning("QgsSpatialRefSys::createFromProj4 error proj string supplied has no +ellps or +a argument");
533+
534+
return mIsValidFlag;
526535
}
527-
mEllipsoidAcronym = theProj4String.mid(myStart+ELLPS_PREFIX_LEN,myLength-ELLPS_PREFIX_LEN);
528536
//mproj4string must be set here for the rest of this method to behave in a meaningful way...
529537
mProj4String = theProj4String;
530538

0 commit comments

Comments
 (0)
Please sign in to comment.