Skip to content
Permalink
Browse files

Fix creation of QgsCoordinateReferenceSystem from "user:xxxx" strings

Fixes #17254
  • Loading branch information
nyalldawson committed Dec 17, 2017
1 parent b59bd94 commit 8cb4893817e4efe8752c4b14c3c69da9f701a417
@@ -220,7 +220,7 @@ bool QgsCoordinateReferenceSystem::createFromString( const QString &definition )
sCrsStringLock.unlock();

bool result = false;
QRegExp reCrsId( "^(epsg|postgis|internal)\\:(\\d+)$", Qt::CaseInsensitive );
QRegExp reCrsId( "^(epsg|postgis|internal|user)\\:(\\d+)$", Qt::CaseInsensitive );
if ( reCrsId.indexIn( definition ) == 0 )
{
QString authName = reCrsId.cap( 1 ).toLower();
@@ -842,6 +842,14 @@ void TestQgsCoordinateReferenceSystem::saveAsUserCrs()
QCOMPARE( userCrs2.srsid(), userCrs.srsid() );
QCOMPARE( userCrs2.authid(), QStringLiteral( "USER:100000" ) );
QCOMPARE( userCrs2.description(), QStringLiteral( "babies first projection" ) );

// createFromString with user crs
QgsCoordinateReferenceSystem userCrs3;
userCrs3.createFromString( QStringLiteral( "USER:100000" ) );
QVERIFY( userCrs3.isValid() );
QCOMPARE( userCrs3.authid(), QString( "USER:100000" ) );
QCOMPARE( userCrs3.toProj4(), madeUpProjection );
QCOMPARE( userCrs3.description(), QStringLiteral( "babies first projection" ) );
}

void TestQgsCoordinateReferenceSystem::projectWithCustomCrs()

0 comments on commit 8cb4893

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