diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index acb18535405..b7de2c7781e 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -848,6 +848,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String ) { // prefer EPSG codes for compatibility with earlier qgis conversions QgsProjUtils::proj_pj_unique_ptr candidateCrs( proj_list_get( QgsProjContext::get(), crsList, i ) ); + candidateCrs = QgsProjUtils::crsToSingleCrs( candidateCrs.get() ); const QString authName( proj_get_id_auth_name( candidateCrs.get(), 0 ) ); if ( confidence[i] > bestConfidence || authName == QLatin1String( "EPSG" ) ) { diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp index de309d40a01..f0f1a95c2d3 100644 --- a/tests/src/core/testqgscoordinatereferencesystem.cpp +++ b/tests/src/core/testqgscoordinatereferencesystem.cpp @@ -523,6 +523,10 @@ void TestQgsCoordinateReferenceSystem::fromProj4() QCOMPARE( myCrs.srsid(), GEOCRS_ID ); myCrs = QgsCoordinateReferenceSystem::fromProj4( QString() ); QVERIFY( !myCrs.isValid() ); + + + myCrs = QgsCoordinateReferenceSystem::fromProj4( "+proj=utm +zone=36 +south +a=6378249.145 +b=6356514.966398753 +towgs84=-143,-90,-294,0,0,0,0 +units=m +no_defs" ); + QCOMPARE( myCrs.authid(), QStringLiteral( "EPSG:20936" ) ); } void TestQgsCoordinateReferenceSystem::proj4Cache()