Skip to content

Commit 4524023

Browse files
committed
Changed the way equality tests are done in qgscoordinatereference system. Simply comparing WKT's is not effective since the same CRS can be expressed in different ways. Now we compare the authid (which may have some side effects but probably less than the old system. All qgscoordinatereferencesystem tests pass now.
1 parent 1f43afd commit 4524023

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,19 +1012,7 @@ long QgsCoordinateReferenceSystem::findMatchingProj()
10121012

10131013
bool QgsCoordinateReferenceSystem::operator==( const QgsCoordinateReferenceSystem &theSrs ) const
10141014
{
1015-
QString myWkt = toWkt();
1016-
QString theirWkt = theSrs.toWkt();
1017-
// if there is a 0,0,0 based Bursa-Wolf conversion, we will test the
1018-
// wkt with the TOWGS84 string removed as OSRImportFromProj4
1019-
// (which is often used in the class to contruct an SRS)
1020-
// does not create the empty TOWGS84 string
1021-
// TODO check 3 parameter form too?
1022-
// see http://www.gdal.org/ogr/classOGRSpatialReference.html
1023-
// TODO this is probably an ugly hack, find a nicer approach TS
1024-
QString myToWGSString( ",TOWGS84[0,0,0,0,0,0,0]" );
1025-
myWkt.replace( myToWGSString, "" );
1026-
theirWkt.replace( myToWGSString, "" );
1027-
return mIsValidFlag && theSrs.mIsValidFlag && myWkt == theirWkt;
1015+
return mIsValidFlag && theSrs.mIsValidFlag && theSrs.authid() == authid();
10281016
}
10291017

10301018
bool QgsCoordinateReferenceSystem::operator!=( const QgsCoordinateReferenceSystem &theSrs ) const
@@ -1035,7 +1023,7 @@ bool QgsCoordinateReferenceSystem::operator!=( const QgsCoordinateReferenceSyste
10351023
bool QgsCoordinateReferenceSystem::equals( QString theProj4String )
10361024
{
10371025
QgsCoordinateReferenceSystem r;
1038-
r.setProj4String( theProj4String );
1026+
r.createFromProj4( theProj4String );
10391027
return *this == r;
10401028
}
10411029

0 commit comments

Comments
 (0)