aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorNyall Dawson <nyall.dawson@gmail.com>2019-12-14 10:15:05 +1000
committerEven Rouault <even.rouault@spatialys.com>2019-12-14 01:15:05 +0100
commitccaebae3cb9424a9b21d0c58237d7e95c9e16b1b (patch)
treedec6e14e4a310c47ed987b7ef67d3e67f14f0fe3 /test/unit
parentc9d6d364a86054f1dddbeb772660375be47aa23b (diff)
downloadPROJ-ccaebae3cb9424a9b21d0c58237d7e95c9e16b1b.tar.gz
PROJ-ccaebae3cb9424a9b21d0c58237d7e95c9e16b1b.zip
Add proj_coordoperation_create_inverse to C API (#1795)
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/test_c_api.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp
index f87f6589..22e2ac11 100644
--- a/test/unit/test_c_api.cpp
+++ b/test/unit/test_c_api.cpp
@@ -3486,6 +3486,36 @@ TEST_F(CApi, proj_normalize_for_visualization_on_crs) {
// ---------------------------------------------------------------------------
+TEST_F(CApi, proj_coordoperation_create_inverse) {
+
+ auto P = proj_create(
+ m_ctxt, "+proj=pipeline +step +proj=axisswap +order=2,1 +step "
+ "+proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=push "
+ "+v_3 +step +proj=cart +ellps=evrst30 +step +proj=helmert "
+ "+x=293 +y=836 +z=318 +rx=0.5 +ry=1.6 +rz=-2.8 +s=2.1 "
+ "+convention=position_vector +step +inv +proj=cart "
+ "+ellps=WGS84 +step +proj=pop +v_3 +step +proj=unitconvert "
+ "+xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1");
+ ObjectKeeper keeper_P(P);
+ ASSERT_NE(P, nullptr);
+ auto Pinversed = proj_coordoperation_create_inverse(m_ctxt, P);
+ ObjectKeeper keeper_Pinversed(Pinversed);
+ ASSERT_NE(Pinversed, nullptr);
+
+ auto projstr = proj_as_proj_string(m_ctxt, Pinversed, PJ_PROJ_5, nullptr);
+ ASSERT_NE(projstr, nullptr);
+ EXPECT_EQ(std::string(projstr),
+ "+proj=pipeline +step +proj=axisswap +order=2,1 +step "
+ "+proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=push +v_3 "
+ "+step +proj=cart +ellps=WGS84 +step +inv +proj=helmert +x=293 "
+ "+y=836 +z=318 +rx=0.5 +ry=1.6 +rz=-2.8 +s=2.1 "
+ "+convention=position_vector +step +inv +proj=cart "
+ "+ellps=evrst30 +step +proj=pop +v_3 +step +proj=unitconvert "
+ "+xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1");
+}
+
+// ---------------------------------------------------------------------------
+
TEST_F(CApi, proj_get_remarks) {
auto co = proj_create_from_database(m_ctxt, "EPSG", "8048",
PJ_CATEGORY_COORDINATE_OPERATION, false,