Skip to content

Commit

Permalink
Fix resolution of bound crs proj strings to auth/code
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 21, 2019
1 parent eafd787 commit c52b1d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -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" ) )
{
Expand Down
4 changes: 4 additions & 0 deletions tests/src/core/testqgscoordinatereferencesystem.cpp
Expand Up @@ -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()
Expand Down

0 comments on commit c52b1d7

Please sign in to comment.