Skip to content

Commit 26322b6

Browse files
committed
One CRS test failure left
1 parent 4d928f6 commit 26322b6

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/core/qgscoordinatereferencesystem.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,14 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
358358
*/
359359
void setDescription( QString theDescription );
360360
/* Set the Proj Proj4String.
361-
* @param QString theProj4String Proj4 format specifies (excluding proj and ellips) that define this srs.
361+
* @param QString theProj4String Proj4 format specifies
362+
* (excluding proj and ellips) that define this srs.
363+
* @note some content of the PROJ4 string may be stripped off by this
364+
* method due to the parsing of the string by OSRNewSpatialReference .
365+
* For example input:
366+
* +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
367+
* Gets stored in the CRS as:
368+
* +proj=longlat +datum=WGS84 +no_defs
362369
*/
363370
void setProj4String( QString theProj4String );
364371
/*! Set this Geographic? flag

tests/src/core/testqgscoordinatereferencesystem.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,20 @@ void TestQgsCoordinateReferenceSystem::toWkt()
231231
myCrs.createFromSrid( GEOSRID );
232232
QString myWkt = myCrs.toWkt();
233233
debugPrint( myCrs );
234-
QVERIFY( myWkt == GEOWKT );
234+
//Note: this is not the same as GEOWKT as OGR strips off the TOWGS clause...
235+
QString myStrippedWkt("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID"
236+
"[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],"
237+
"AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY"
238+
"[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY"
239+
"[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]");
240+
QVERIFY( myWkt == myStrippedWkt );
235241
}
236242
void TestQgsCoordinateReferenceSystem::toProj4()
237243
{
238244
QgsCoordinateReferenceSystem myCrs;
239245
myCrs.createFromSrid( GEOSRID );
240246
debugPrint( myCrs );
241-
QVERIFY( myCrs.toProj4() == GEOPROJ4 );
247+
QVERIFY( myCrs.toProj4() == "+proj=longlat +datum=WGS84 +no_defs" );
242248
}
243249
void TestQgsCoordinateReferenceSystem::geographicFlag()
244250
{

0 commit comments

Comments
 (0)