diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-12-10 14:36:07 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-12-10 15:25:02 +0100 |
| commit | 2c3a7c8bcc711cf34b79885edbf1e5dccacc5757 (patch) | |
| tree | 62fad710df23f50d8c15ad7625e6f814488078af /test/unit/pj_transform_test.cpp | |
| parent | 29474bd7fdac013841a4795e93f714bba7791c56 (diff) | |
| download | PROJ-2c3a7c8bcc711cf34b79885edbf1e5dccacc5757.tar.gz PROJ-2c3a7c8bcc711cf34b79885edbf1e5dccacc5757.zip | |
ob_tran: restore traditional handling of +to_meter with pj_transform() and proj utility (fixes #1782)
Fixes side-effect of https://github.com/OSGeo/PROJ/issues/1525 that went in 6.1.1
The correction is horribly hacky. Sorry...
Diffstat (limited to 'test/unit/pj_transform_test.cpp')
| -rw-r--r-- | test/unit/pj_transform_test.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unit/pj_transform_test.cpp b/test/unit/pj_transform_test.cpp index b3a061b4..1f4473c1 100644 --- a/test/unit/pj_transform_test.cpp +++ b/test/unit/pj_transform_test.cpp @@ -614,4 +614,38 @@ TEST(proj_api_h, pj_set_finder) { pj_set_finder(nullptr); } +// --------------------------------------------------------------------------- + +TEST(pj_transform_test, ob_tran_to_meter_as_dest) { + auto src = pj_init_plus( + "+ellps=WGS84 +a=57.29577951308232 +proj=eqc +lon_0=0.0 +no_defs"); + auto dst = pj_init_plus("+ellps=WGS84 +proj=ob_tran +o_proj=latlon " + "+o_lon_p=0.0 +o_lat_p=90.0 +lon_0=360.0 " + "+to_meter=0.0174532925199433 +no_defs"); + double x = 2 * DEG_TO_RAD; + double y = 49 * DEG_TO_RAD; + EXPECT_EQ(pj_transform(src, dst, 1, 0, &x, &y, nullptr), 0); + EXPECT_NEAR(x, 2 * DEG_TO_RAD, 1e-12) << x / DEG_TO_RAD; + EXPECT_NEAR(y, 49 * DEG_TO_RAD, 1e-12) << y / DEG_TO_RAD; + pj_free(src); + pj_free(dst); +} + +// --------------------------------------------------------------------------- + +TEST(pj_transform_test, ob_tran_to_meter_as_srouce) { + auto src = pj_init_plus("+ellps=WGS84 +proj=ob_tran +o_proj=latlon " + "+o_lon_p=0.0 +o_lat_p=90.0 +lon_0=360.0 " + "+to_meter=0.0174532925199433 +no_defs"); + auto dst = pj_init_plus( + "+ellps=WGS84 +a=57.29577951308232 +proj=eqc +lon_0=0.0 +no_defs"); + double x = 2 * DEG_TO_RAD; + double y = 49 * DEG_TO_RAD; + EXPECT_EQ(pj_transform(src, dst, 1, 0, &x, &y, nullptr), 0); + EXPECT_NEAR(x, 2 * DEG_TO_RAD, 1e-12) << x / DEG_TO_RAD; + EXPECT_NEAR(y, 49 * DEG_TO_RAD, 1e-12) << y / DEG_TO_RAD; + pj_free(src); + pj_free(dst); +} + } // namespace |
