Skip to content
Permalink
Browse files

Fix incorrect authid and description after saving a user crs

  • Loading branch information
nyalldawson committed Nov 13, 2017
1 parent 39851f4 commit e967881e45282e520c3d0345d342b98b3228ca60
@@ -1698,6 +1698,9 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )

returnId = sqlite3_last_insert_rowid( myDatabase );
setInternalId( returnId );
if ( authid().isEmpty() )
setAuthId( QStringLiteral( "USER:%1" ).arg( returnId ) );
setDescription( name );

//We add the just created user CRS to the list of recently used CRS
QgsSettings settings;
@@ -822,12 +822,16 @@ void TestQgsCoordinateReferenceSystem::saveAsUserCrs()
long newId = userCrs.saveAsUserCrs( QStringLiteral( "babies first projection" ) );
QCOMPARE( newId, static_cast< long >( USER_CRS_START_ID ) );
QCOMPARE( userCrs.srsid(), newId );
QCOMPARE( userCrs.authid(), QStringLiteral( "USER:100000" ) );
QCOMPARE( userCrs.description(), QStringLiteral( "babies first projection" ) );

// new CRS with same definition, check that it's matched to user crs
QgsCoordinateReferenceSystem userCrs2 = QgsCoordinateReferenceSystem::fromProj4( madeUpProjection );
QVERIFY( userCrs2.isValid() );
QCOMPARE( userCrs2.toProj4(), madeUpProjection );
QCOMPARE( userCrs2.srsid(), userCrs.srsid() );
QCOMPARE( userCrs2.authid(), QStringLiteral( "USER:100000" ) );
QCOMPARE( userCrs2.description(), QStringLiteral( "babies first projection" ) );
}

QGSTEST_MAIN( TestQgsCoordinateReferenceSystem )

0 comments on commit e967881

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