ogr provider: improve detection of CRS

git-svn-id: http://svn.osgeo.org/qgis/trunk@15502 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2011-03-15 16:24:06 +00:00
parent 57a0ddde78
commit 393e206e2d

View File

@ -1841,12 +1841,22 @@ QgsCoordinateReferenceSystem QgsOgrProvider::crs()
{
QgsDebugMsg( "no spatial reference found" );
}
else if ( OSRAutoIdentifyEPSG( mySpatialRefSys ) == OGRERR_NONE )
{
QString authid = QString( "%1:%2" )
.arg( OSRGetAuthorityName( mySpatialRefSys, NULL ) )
.arg( OSRGetAuthorityCode( mySpatialRefSys, NULL ) );
QgsDebugMsg( "authid recognized as " + authid );
srs.createFromOgcWmsCrs( authid );
}
else
{
// get the proj4 text
char *ppszProj4;
OSRExportToProj4( mySpatialRefSys, &ppszProj4 );
QgsDebugMsg( ppszProj4 );
char *pszProj4;
OSRExportToProj4( mySpatialRefSys, &pszProj4 );
QgsDebugMsg( pszProj4 );
OGRFree( pszProj4 );
char *pszWkt = NULL;
OSRExportToWkt( mySpatialRefSys, &pszWkt );
QString myWktString = QString( pszWkt );