Skip to content

Commit f2d40a7

Browse files
author
jef
committed
ogr provider: improve detection of CRS
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15502 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 9d45cff commit f2d40a7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/providers/ogr/qgsogrprovider.cpp

+13-3
Original file line numberDiff line numberDiff 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 );

0 commit comments

Comments
 (0)