aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-09-11 19:25:35 +0200
committerEven Rouault <even.rouault@spatialys.com>2019-09-11 19:25:35 +0200
commite22dbb571e6c721c1e3edb33735b6b51ade9f1dc (patch)
tree9713df3a7cfb370b3685d481c8fc46f303189d31 /test
parentbd39128c3e278331980adf02377e9347269cb820 (diff)
downloadPROJ-e22dbb571e6c721c1e3edb33735b6b51ade9f1dc.tar.gz
PROJ-e22dbb571e6c721c1e3edb33735b6b51ade9f1dc.zip
createOperations(): fix conversion from/to PROJ.4 CRS strings with non-ISO-cosher options and towgs84/nadgrids
This actually fixes a regression introduced in PROJ 6.2.0 per 78302efb70eb4b49610cda6a60bf9ce39b82264f that made a conversion like EPSG:4326 to "+proj=something +towgs84/+nadgrids +over +type=crs" apply the towgs84/nadgrids operation twice.
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_operation.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index 96727c2b..38f0864d 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -7187,6 +7187,30 @@ TEST(operation,
// ---------------------------------------------------------------------------
+TEST(
+ operation,
+ createOperation_fallback_to_proj4_strings_regular_to_projliteral_with_towgs84) {
+ auto objSrc =
+ createFromUserInput("EPSG:4326", DatabaseContext::create(), false);
+ auto src = nn_dynamic_pointer_cast<CRS>(objSrc);
+ ASSERT_TRUE(src != nullptr);
+
+ auto objDst = PROJStringParser().createFromPROJString(
+ "+proj=utm +zone=31 +ellps=GRS80 +towgs84=1,2,3 +over +type=crs");
+ auto dst = nn_dynamic_pointer_cast<CRS>(objDst);
+ ASSERT_TRUE(dst != nullptr);
+
+ auto op = CoordinateOperationFactory::create()->createOperation(
+ NN_CHECK_ASSERT(src), NN_CHECK_ASSERT(dst));
+ ASSERT_TRUE(op != nullptr);
+ EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline +step +proj=axisswap +order=2,1 "
+ "+step +proj=unitconvert +xy_in=deg +xy_out=rad "
+ "+step +proj=utm +zone=31 +ellps=GRS80 +towgs84=1,2,3 +over");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, createOperation_on_crs_with_bound_crs_and_wktext) {
auto objSrc = PROJStringParser().createFromPROJString(
"+proj=utm +zone=55 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 "