From 26322b6a3df271fb373fe4d9e22bb3fbb4cced50 Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Sat, 7 Apr 2012 07:08:55 +0200 Subject: [PATCH] One CRS test failure left --- src/core/qgscoordinatereferencesystem.h | 9 ++++++++- tests/src/core/testqgscoordinatereferencesystem.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/core/qgscoordinatereferencesystem.h b/src/core/qgscoordinatereferencesystem.h index 850288a20ad9..de9feaf6f1b2 100644 --- a/src/core/qgscoordinatereferencesystem.h +++ b/src/core/qgscoordinatereferencesystem.h @@ -358,7 +358,14 @@ class CORE_EXPORT QgsCoordinateReferenceSystem */ void setDescription( QString theDescription ); /* Set the Proj Proj4String. - * @param QString theProj4String Proj4 format specifies (excluding proj and ellips) that define this srs. + * @param QString theProj4String Proj4 format specifies + * (excluding proj and ellips) that define this srs. + * @note some content of the PROJ4 string may be stripped off by this + * method due to the parsing of the string by OSRNewSpatialReference . + * For example input: + * +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs + * Gets stored in the CRS as: + * +proj=longlat +datum=WGS84 +no_defs */ void setProj4String( QString theProj4String ); /*! Set this Geographic? flag diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp index 7282d2b81033..26d0f9cfee53 100644 --- a/tests/src/core/testqgscoordinatereferencesystem.cpp +++ b/tests/src/core/testqgscoordinatereferencesystem.cpp @@ -231,14 +231,20 @@ void TestQgsCoordinateReferenceSystem::toWkt() myCrs.createFromSrid( GEOSRID ); QString myWkt = myCrs.toWkt(); debugPrint( myCrs ); - QVERIFY( myWkt == GEOWKT ); + //Note: this is not the same as GEOWKT as OGR strips off the TOWGS clause... + QString myStrippedWkt("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID" + "[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]]," + "AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY" + "[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY" + "[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"); + QVERIFY( myWkt == myStrippedWkt ); } void TestQgsCoordinateReferenceSystem::toProj4() { QgsCoordinateReferenceSystem myCrs; myCrs.createFromSrid( GEOSRID ); debugPrint( myCrs ); - QVERIFY( myCrs.toProj4() == GEOPROJ4 ); + QVERIFY( myCrs.toProj4() == "+proj=longlat +datum=WGS84 +no_defs" ); } void TestQgsCoordinateReferenceSystem::geographicFlag() {