Skip to content

Commit 5d60b28

Browse files
committed
cleanup on e50f042
1 parent 078a941 commit 5d60b28

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
593593
}
594594
}
595595

596-
QStringList myParam;
597596
if ( myRecord.empty() )
598597
{
599598
// match all parameters individually:
@@ -608,6 +607,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
608607
// split on spaces followed by a plus sign (+) to deal
609608
// also with parameters containing spaces (e.g. +nadgrids)
610609
// make sure result is trimmed (#5598)
610+
QStringList myParams;
611611
foreach ( QString param, myProj4String.split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
612612
{
613613
QString arg = QString( "' '||parameters||' ' LIKE %1" ).arg( quotedValue( QString( "% %1 %" ).arg( param.trimmed() ) ) );
@@ -619,7 +619,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
619619
{
620620
sql += delim + arg;
621621
delim = " AND ";
622-
myParam.append(param);
622+
myParams << param.trimmed();
623623
}
624624
}
625625

@@ -633,32 +633,34 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
633633
// datum might have disappeared in definition - retry without it
634634
myRecord = getRecord( sql + " order by deprecated" );
635635
}
636+
637+
if ( !myRecord.empty() )
638+
{
639+
// Bugfix 8487 : test param lists are equal, except for +datum
640+
QStringList foundParams;
641+
foreach ( QString param, myRecord["parameters"].split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
642+
{
643+
if ( !param.startsWith( "+datum=" ) )
644+
foundParams << param.trimmed();
645+
}
646+
647+
myParams.sort();
648+
foundParams.sort();
649+
650+
if ( myParams != foundParams )
651+
{
652+
myRecord.clear();
653+
}
654+
}
636655
}
637656

638657
if ( !myRecord.empty() )
639658
{
640659
mySrsId = myRecord["srs_id"].toLong();
641660
QgsDebugMsg( "proj4string param match search for srsid returned srsid: " + QString::number( mySrsId ) );
642-
// Bugfix 8487 : test param lists are equal, except for +datum
643-
myParam.sort();
644-
QStringList foundParam;
645-
foreach ( QString paramfound, myRecord["parameters"].split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
646-
{
647-
if ( !paramfound.startsWith( "+datum=" ) )
648-
foundParam.append(paramfound);
649-
}
650-
foundParam.sort();
651-
if ( myParam == foundParam)
652-
{
653-
if ( mySrsId > 0 )
654-
{
655-
createFromSrsId( mySrsId );
656-
}
657-
}
658-
else
661+
if ( mySrsId > 0 )
659662
{
660-
// Params differ
661-
mIsValidFlag = false;
663+
createFromSrsId( mySrsId );
662664
}
663665
}
664666
else

0 commit comments

Comments
 (0)