Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 546c2de
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -593,6 +593,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
}
}

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

Expand All @@ -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
Expand Down

0 comments on commit 546c2de

Please sign in to comment.