aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-11-03 16:20:18 +0100
committerGitHub <noreply@github.com>2019-11-03 16:20:18 +0100
commitb56c19d71b2d8f8d0319b8df1f8596aae891fafe (patch)
treed69b629f57375aa23d1a7c8f8e56647b019d56ab /test/unit
parent5ce02144c3802703da57d753ac7572099f0e4551 (diff)
parent5e5997a61062041c5833a4c6e7a46e8181d39c64 (diff)
downloadPROJ-b56c19d71b2d8f8d0319b8df1f8596aae891fafe.tar.gz
PROJ-b56c19d71b2d8f8d0319b8df1f8596aae891fafe.zip
Merge pull request #1711 from rouault/fix_gdal_1972
createOperations(): in some circumstances we wrongly promoted a Helmert geog2D transformation to a geog3D
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/test_operation.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index 7d457dab..8df785b1 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -5523,6 +5523,49 @@ TEST(operation, projCRS_no_id_to_geogCRS_context) {
// ---------------------------------------------------------------------------
+TEST(operation, geogCRS_3D_to_projCRS_with_2D_geocentric_translation) {
+
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
+ auto src =
+ authFactory->createCoordinateReferenceSystem("4979"); // WGS 84 3D
+
+ // Azores Central 1948 / UTM zone 26N
+ auto dst = authFactory->createCoordinateReferenceSystem("2189");
+
+ auto list =
+ CoordinateOperationFactory::create()->createOperations(src, dst, ctxt);
+ ASSERT_GE(list.size(), 1U);
+ EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline "
+ "+step +proj=axisswap +order=2,1 "
+ "+step +proj=unitconvert +xy_in=deg +z_in=m +xy_out=rad +z_out=m "
+ "+step +proj=push +v_3 " // this is what we check
+ "+step +proj=cart +ellps=WGS84 "
+ "+step +proj=helmert +x=104 +y=-167 +z=38 "
+ "+step +inv +proj=cart +ellps=intl "
+ "+step +proj=pop +v_3 " // this is what we check
+ "+step +proj=utm +zone=26 +ellps=intl");
+
+ auto listReverse =
+ CoordinateOperationFactory::create()->createOperations(dst, src, ctxt);
+ ASSERT_GE(listReverse.size(), 1U);
+ EXPECT_EQ(
+ listReverse[0]->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline "
+ "+step +inv +proj=utm +zone=26 +ellps=intl "
+ "+step +proj=push +v_3 " // this is what we check
+ "+step +proj=cart +ellps=intl "
+ "+step +proj=helmert +x=-104 +y=167 +z=-38 "
+ "+step +inv +proj=cart +ellps=WGS84 "
+ "+step +proj=pop +v_3 " // this is what we check
+ "+step +proj=unitconvert +xy_in=rad +z_in=m +xy_out=deg +z_out=m "
+ "+step +proj=axisswap +order=2,1");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, projCRS_to_projCRS) {
auto op = CoordinateOperationFactory::create()->createOperation(