File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1841,12 +1841,22 @@ QgsCoordinateReferenceSystem QgsOgrProvider::crs()
1841
1841
{
1842
1842
QgsDebugMsg ( " no spatial reference found" );
1843
1843
}
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
+ }
1844
1852
else
1845
1853
{
1846
1854
// 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
+
1850
1860
char *pszWkt = NULL ;
1851
1861
OSRExportToWkt ( mySpatialRefSys, &pszWkt );
1852
1862
QString myWktString = QString ( pszWkt );
You can’t perform that action at this time.
0 commit comments