@@ -807,7 +807,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
807
807
d->mWkt .clear ();
808
808
809
809
// seems broken. Sigh.
810
- #if 0 // PROJ_VERSION_MAJOR>=6
810
+ #if PROJ_VERSION_MAJOR>=6
811
811
// first, try to use proj to do this for us...
812
812
QgsProjUtils::proj_pj_unique_ptr crs ( proj_create ( QgsProjContext::get (), proj4String.toLatin1 ().constData () ) );
813
813
if ( crs )
@@ -817,14 +817,16 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
817
817
if ( PJ_OBJ_LIST *crsList = proj_identify ( QgsProjContext::get (), crs.get (), nullptr , nullptr , &confidence ) )
818
818
{
819
819
const int count = proj_list_get_count ( crsList );
820
+ int confidence0 = 0 ;
820
821
QgsProjUtils::proj_pj_unique_ptr matchedCrs;
821
822
if ( count > 0 )
822
823
{
823
824
matchedCrs.reset ( proj_list_get ( QgsProjContext::get (), crsList, 0 ) );
825
+ confidence0 = confidence[0 ];
824
826
}
825
827
proj_list_destroy ( crsList );
826
828
proj_int_list_destroy ( confidence );
827
- if ( matchedCrs && confidence[0] >= 70 )
829
+ if ( matchedCrs && confidence0 >= 70 )
828
830
{
829
831
const QString authName ( proj_get_id_auth_name ( crs.get (), 0 ) );
830
832
const QString authCode ( proj_get_id_code ( crs.get (), 0 ) );
@@ -840,11 +842,14 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
840
842
}
841
843
}
842
844
}
845
+ #endif
843
846
847
+ // IDEALLY!!
844
848
// don't do any of this for proj 6 -- responsibility for all this rests in the proj library.
845
849
// Woohoo! we can be free of this legacy cruft FOREVER!
846
850
// (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
848
853
QRegExp myProjRegExp ( " \\ +proj=(\\ S+)" );
849
854
int myStart = myProjRegExp.indexIn ( myProj4String );
850
855
if ( myStart == -1 )
0 commit comments