Skip to content
Permalink
Browse files

A fix for comparing two CRS:es that only differs by their +towgs84 pa…

…rams. Fixes partly #1815.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11380 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann
homann committed Aug 14, 2009
1 parent 405c748 commit a51b0a09c37f04315cce7073db13a3a413de5501
Showing with 22 additions and 12 deletions.
  1. +22 −12 src/core/qgscoordinatereferencesystem.cpp
@@ -876,20 +876,29 @@ bool QgsCoordinateReferenceSystem::operator==( const QgsCoordinateReferenceSyste
{
return false;
}
else if ( OSRIsGeographic( mCRS ) && OSRIsGeographic( theSrs.mCRS ) )
{
// qWarning("QgsCoordinateReferenceSystem::operator== srs1 and srs2 are geographic ");
return OSRIsSameGeogCS( mCRS, theSrs.mCRS );
}
else if ( OSRIsProjected( mCRS ) && OSRIsProjected( theSrs.mCRS ) )
{
// qWarning("QgsCoordinateReferenceSystem::operator== srs1 and srs2 are projected ");
return OSRIsSame( mCRS, theSrs.mCRS );
}
else
char *thisStr;
char *otherStr;

// OSRIsSame is not relaibel when it comes to comparing +towgs84 parameters
// Use string compare on WKT instead.
if ( ( OSRExportToWkt( mCRS, &thisStr ) == OGRERR_NONE ) )
{
return false;
if ( OSRExportToWkt( theSrs.mCRS, &otherStr ) == OGRERR_NONE )
{
QgsDebugMsg( QString( "Comparing " ) + thisStr );
QgsDebugMsg( QString( " with " ) + otherStr );
if ( !strcmp( thisStr, otherStr ) )
{
QgsDebugMsg( QString( "MATCHED!" ) + otherStr );
OGRFree( *thisStr );
OGRFree( *otherStr );
return true;
}
OGRFree( *otherStr );
}
OGRFree( *thisStr );
}
return false;
}

bool QgsCoordinateReferenceSystem::operator!=( const QgsCoordinateReferenceSystem &theSrs )
@@ -1135,6 +1144,7 @@ void QgsCoordinateReferenceSystem::debugPrint()
QgsDebugMsg( "* Valid : " + ( mIsValidFlag ? QString( "true" ) : QString( "false" ) ) );
QgsDebugMsg( "* SrsId : " + QString::number( mSrsId ) );
QgsDebugMsg( "* Proj4 : " + toProj4() );
QgsDebugMsg( "* WKT : " + toWkt() );
QgsDebugMsg( "* Desc. : " + mDescription );
if ( mapUnits() == QGis::Meters )
{

0 comments on commit a51b0a0

Please sign in to comment.
You can’t perform that action at this time.