diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-09-24 18:17:10 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-09-30 12:07:50 +0200 |
| commit | 47b9629c56bd97022c1a7161cedc32b97b360957 (patch) | |
| tree | 7189fcff38dd66a16056a7d0f641b8bce66ef68b /test | |
| parent | a9ac32ed3ae8ae53e54635c017f530311ab19758 (diff) | |
| download | PROJ-47b9629c56bd97022c1a7161cedc32b97b360957.tar.gz PROJ-47b9629c56bd97022c1a7161cedc32b97b360957.zip | |
proj_factors(): accept P to be a projected CRS (fixes #2854)
Updated doc:
Starting with PROJ 8.2, the P object can be a projected CRS, for example
instantiated from a EPSG CRS code. The factors computed will be those of the
map projection implied by the transformation from the base geographic CRS of
the projected CRS to the projected CRS.
The input geodetic coordinate lp should be such that lp.lam is the longitude
in radian, and lp.phi the latitude in radian (thus independently of the
definition of the base CRS, if P is a projected CRS).
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit/gie_self_tests.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp index 5fc8f0f1..5f96a93a 100644 --- a/test/unit/gie_self_tests.cpp +++ b/test/unit/gie_self_tests.cpp @@ -475,6 +475,33 @@ TEST(gie, info_functions) { proj_destroy(P); + // Test with a projected CRS + { + P = proj_create(PJ_DEFAULT_CTX, "EPSG:3395"); + + const auto factors2 = proj_factors(P, a); + + EXPECT_EQ(factors.angular_distortion, factors2.angular_distortion); + EXPECT_EQ(factors.meridian_parallel_angle, + factors2.meridian_parallel_angle); + EXPECT_EQ(factors.meridian_convergence, factors2.meridian_convergence); + EXPECT_EQ(factors.tissot_semimajor, factors2.tissot_semimajor); + + proj_destroy(P); + } + + // Test with a geographic CRS --> error + { + P = proj_create(PJ_DEFAULT_CTX, "EPSG:4326"); + + const auto factors2 = proj_factors(P, a); + EXPECT_NE(proj_errno(P), 0); + proj_errno_reset(P); + EXPECT_EQ(factors2.meridian_parallel_angle, 0); + + proj_destroy(P); + } + /* Check that proj_list_* functions work by looping through them */ size_t n = 0; for (oper_list = proj_list_operations(); oper_list->id; ++oper_list) |
