File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1841,12 +1841,22 @@ QgsCoordinateReferenceSystem QgsOgrProvider::crs()
18411841 {
18421842 QgsDebugMsg ( " no spatial reference found" );
18431843 }
1844+ else if ( OSRAutoIdentifyEPSG ( mySpatialRefSys ) == OGRERR_NONE )
1845+ {
1846+ QString authid = QString ( " %1:%2" )
1847+ .arg ( OSRGetAuthorityName ( mySpatialRefSys, NULL ) )
1848+ .arg ( OSRGetAuthorityCode ( mySpatialRefSys, NULL ) );
1849+ QgsDebugMsg ( " authid recognized as " + authid );
1850+ srs.createFromOgcWmsCrs ( authid );
1851+ }
18441852 else
18451853 {
18461854 // get the proj4 text
1847- char *ppszProj4;
1848- OSRExportToProj4 ( mySpatialRefSys, &ppszProj4 );
1849- QgsDebugMsg ( ppszProj4 );
1855+ char *pszProj4;
1856+ OSRExportToProj4 ( mySpatialRefSys, &pszProj4 );
1857+ QgsDebugMsg ( pszProj4 );
1858+ OGRFree ( pszProj4 );
1859+
18501860 char *pszWkt = NULL ;
18511861 OSRExportToWkt ( mySpatialRefSys, &pszWkt );
18521862 QString myWktString = QString ( pszWkt );
You can’t perform that action at this time.
0 commit comments