aboutsummaryrefslogtreecommitdiff
path: root/test/unit/gie_self_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/gie_self_tests.cpp')
-rw-r--r--test/unit/gie_self_tests.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp
index 1b5ce83b..2d298ea3 100644
--- a/test/unit/gie_self_tests.cpp
+++ b/test/unit/gie_self_tests.cpp
@@ -659,4 +659,57 @@ TEST(gie, horner_selftest) {
proj_destroy(P);
}
+// ---------------------------------------------------------------------------
+
+TEST(gie, proj_create_crs_to_crs_PULKOVO42_ETRS89) {
+ auto P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "EPSG:4179", "EPSG:4258",
+ nullptr);
+ ASSERT_TRUE(P != nullptr);
+ PJ_COORD c;
+
+ EXPECT_EQ(std::string(proj_pj_info(P).definition),
+ "unavailable until proj_trans is called");
+ EXPECT_EQ(proj_get_name(P), nullptr);
+ EXPECT_EQ(P->fwd, nullptr);
+ EXPECT_EQ(P->fwd3d, nullptr);
+ EXPECT_EQ(P->fwd4d, nullptr);
+
+ // Romania
+ c.xyz.x = 45; // Lat
+ c.xyz.y = 25; // Long
+ c.xyz.z = 0;
+ c = proj_trans(P, PJ_FWD, c);
+ EXPECT_NEAR(c.xy.x, 44.999701238, 1e-9);
+ EXPECT_NEAR(c.xy.y, 24.998474948, 1e-9);
+ EXPECT_EQ(std::string(proj_pj_info(P).definition),
+ "proj=pipeline step proj=axisswap order=2,1 step "
+ "proj=unitconvert xy_in=deg xy_out=rad step proj=cart "
+ "ellps=krass step proj=helmert x=2.3287 y=-147.0425 z=-92.0802 "
+ "rx=0.3092483 ry=-0.32482185 rz=-0.49729934 s=5.68906266 "
+ "convention=coordinate_frame step inv proj=cart ellps=GRS80 step "
+ "proj=unitconvert xy_in=rad xy_out=deg step proj=axisswap "
+ "order=2,1");
+
+ c = proj_trans(P, PJ_INV, c);
+ EXPECT_NEAR(c.xy.x, 45, 1e-9);
+ EXPECT_NEAR(c.xy.y, 25, 1e-9);
+
+ // Poland
+ c.xyz.x = 52; // Lat
+ c.xyz.y = 20; // Long
+ c.xyz.z = 0;
+ c = proj_trans(P, PJ_FWD, c);
+ EXPECT_NEAR(c.xy.x, 51.999714150, 1e-9);
+ EXPECT_NEAR(c.xy.y, 19.998187811, 1e-9);
+ EXPECT_EQ(std::string(proj_pj_info(P).definition),
+ "proj=pipeline step proj=axisswap order=2,1 step "
+ "proj=unitconvert xy_in=deg xy_out=rad step proj=cart "
+ "ellps=krass step proj=helmert x=33.4 y=-146.6 z=-76.3 rx=-0.359 "
+ "ry=-0.053 rz=0.844 s=-0.84 convention=position_vector step inv "
+ "proj=cart ellps=GRS80 step proj=unitconvert xy_in=rad "
+ "xy_out=deg step proj=axisswap order=2,1");
+
+ proj_destroy(P);
+}
+
} // namespace