Skip to content

Commit 0b8e38e

Browse files
committed
Leave broken code in place for now, it can't hurt, can it?
1 parent 0a7f5fc commit 0b8e38e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
807807
d->mWkt.clear();
808808

809809
// seems broken. Sigh.
810-
#if 0 // PROJ_VERSION_MAJOR>=6
810+
#if PROJ_VERSION_MAJOR>=6
811811
// first, try to use proj to do this for us...
812812
QgsProjUtils::proj_pj_unique_ptr crs( proj_create( QgsProjContext::get(), proj4String.toLatin1().constData() ) );
813813
if ( crs )
@@ -817,14 +817,16 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
817817
if ( PJ_OBJ_LIST *crsList = proj_identify( QgsProjContext::get(), crs.get(), nullptr, nullptr, &confidence ) )
818818
{
819819
const int count = proj_list_get_count( crsList );
820+
int confidence0 = 0;
820821
QgsProjUtils::proj_pj_unique_ptr matchedCrs;
821822
if ( count > 0 )
822823
{
823824
matchedCrs.reset( proj_list_get( QgsProjContext::get(), crsList, 0 ) );
825+
confidence0 = confidence[0];
824826
}
825827
proj_list_destroy( crsList );
826828
proj_int_list_destroy( confidence );
827-
if ( matchedCrs && confidence[0] >= 70 )
829+
if ( matchedCrs && confidence0 >= 70 )
828830
{
829831
const QString authName( proj_get_id_auth_name( crs.get(), 0 ) );
830832
const QString authCode( proj_get_id_code( crs.get(), 0 ) );
@@ -840,11 +842,14 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
840842
}
841843
}
842844
}
845+
#endif
843846

847+
// IDEALLY!!
844848
// don't do any of this for proj 6 -- responsibility for all this rests in the proj library.
845849
// Woohoo! we can be free of this legacy cruft FOREVER!
846850
// (and if any of this has value, take it up with the proj project. That's where it belongs)
847-
#else
851+
// EXCEPT ABOVE SEEMS BROKEN so whatever..
852+
#if 1
848853
QRegExp myProjRegExp( "\\+proj=(\\S+)" );
849854
int myStart = myProjRegExp.indexIn( myProj4String );
850855
if ( myStart == -1 )

tests/src/core/testqgscoordinatereferencesystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ void TestQgsCoordinateReferenceSystem::projectEPSG25833()
910910
QVERIFY( p.read( TEST_DATA_DIR + QStringLiteral( "/projects/epsg25833.qgs" ) ) );
911911
QVERIFY( p.crs().isValid() );
912912
#if PROJ_VERSION_MAJOR>=6
913-
QCOMPARE( p.crs().toProj4(), QStringLiteral( "+proj=utm +zone=33 +ellps=GRS80 +units=m +no_defs" ) ); // matching to EPSG:25833 is broken on proj6 --remove when fixed
913+
QCOMPARE( p.crs().toProj4(), QStringLiteral( "+proj=utm +zone=33 +ellps=GRS80 +units=m +no_defs" ) ); // matching proj string to EPSG:25833 is broken on proj6 --remove when fixed
914914
#else
915915
QCOMPARE( p.crs().authid(), QStringLiteral( "EPSG:25833" ) );
916916
#endif

0 commit comments

Comments
 (0)