Skip to content
Permalink
Browse files

Fix Blocker issue 8487

Custom CRS are saved if cannot find an existing one with same parameters
(except datum which may be optionnal, as GDAL seems to have drop it)
  • Loading branch information
tqhien authored and jef-n committed Sep 15, 2013
1 parent 9c8bc7d commit 546c2de44db3ba2956a4a64fbd33253ef42a5437
Showing with 21 additions and 2 deletions.
  1. +21 −2 src/core/qgscoordinatereferencesystem.cpp
@@ -593,6 +593,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
}
}

QStringList myParam;
if ( myRecord.empty() )
{
// match all parameters individually:
@@ -618,6 +619,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
{
sql += delim + arg;
delim = " AND ";
myParam.append(param);
}
}

@@ -637,9 +639,26 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
{
mySrsId = myRecord["srs_id"].toLong();
QgsDebugMsg( "proj4string param match search for srsid returned srsid: " + QString::number( mySrsId ) );
if ( mySrsId > 0 )
// Bugfix 8487 : test param lists are equal, except for +datum
myParam.sort();
QStringList foundParam;
foreach ( QString paramfound, myRecord["parameters"].split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
{
createFromSrsId( mySrsId );
if ( !paramfound.startsWith( "+datum=" ) )
foundParam.append(paramfound);
}
foundParam.sort();
if ( myParam == foundParam)
{
if ( mySrsId > 0 )
{
createFromSrsId( mySrsId );
}
}
else
{
// Params differ
mIsValidFlag = false;
}
}
else

0 comments on commit 546c2de

Please sign in to comment.
You can’t perform that action at this time.