From 62799e10a3aa51e61e428e87f4aec10f65c737cb Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 26 Jan 2019 18:17:44 +0100 Subject: proj_trans_generic(): make it work with multiple internal coordinate operations (fixes #1237) --- src/4D_api.cpp | 5 +---- test/unit/gie_self_tests.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/4D_api.cpp b/src/4D_api.cpp index 97aadb12..15ac1e8a 100644 --- a/src/4D_api.cpp +++ b/src/4D_api.cpp @@ -379,10 +379,7 @@ size_t proj_trans_generic ( coord.xyzt.z = *z; coord.xyzt.t = *t; - if (PJ_FWD==direction) - coord = pj_fwd4d (coord, P); - else - coord = pj_inv4d (coord, P); + coord = proj_trans(P, direction, coord); /* in all full length cases, we overwrite the input with the output, */ /* and step on to the next element. */ diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp index 2d298ea3..14bb2241 100644 --- a/test/unit/gie_self_tests.cpp +++ b/test/unit/gie_self_tests.cpp @@ -694,6 +694,17 @@ TEST(gie, proj_create_crs_to_crs_PULKOVO42_ETRS89) { EXPECT_NEAR(c.xy.x, 45, 1e-9); EXPECT_NEAR(c.xy.y, 25, 1e-9); + c.xyz.x = 45; // Lat + c.xyz.y = 25; // Long + c.xyz.z = 0; + proj_trans_generic (P, PJ_FWD, + &(c.xyz.x), sizeof(double), 1, + &(c.xyz.y), sizeof(double), 1, + &(c.xyz.z), sizeof(double), 1, + nullptr, 0, 0); + EXPECT_NEAR(c.xy.x, 44.999701238, 1e-9); + EXPECT_NEAR(c.xy.y, 24.998474948, 1e-9); + // Poland c.xyz.x = 52; // Lat c.xyz.y = 20; // Long -- cgit v1.2.3