From e5706305795ed822a5197bda51e75a44ec14728b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 15 Dec 2020 18:30:24 +0100 Subject: projinfo: add a --accuracy option to define the minimum accuracy --- test/cli/testprojinfo | 4 ++++ test/cli/testprojinfo_out.dist | 3 +++ 2 files changed, 7 insertions(+) (limited to 'test') diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo index c31cfef0..ee1b27f5 100755 --- a/test/cli/testprojinfo +++ b/test/cli/testprojinfo @@ -213,6 +213,10 @@ fi rm testprojinfo_out_remotedata.txt unset PROJ_NETWORK +echo 'Testing --accuracy 0.05 -s EPSG:4326 -t EPSG:4258' >> ${OUT} +$EXE --accuracy 0.05 -s EPSG:4326 -t EPSG:4258 >>${OUT} 2>&1 +echo "" >>${OUT} + ###################### # NZGD2000 -> ITRFxx # ###################### diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index 8e8ef294..829c914c 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -1384,6 +1384,9 @@ DATUM["World Geodetic System 1984", LENGTHUNIT["metre",1]], ID["EPSG",6326]] +Testing --accuracy 0.05 -s EPSG:4326 -t EPSG:4258 +Candidate operations found: 0 + Testing -s NZGD2000 -t ITRF96 -o PROJ -q +proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad -- cgit v1.2.3 From 37755e4edc53e09286cd2bb962299d0f5118fc77 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 15 Dec 2020 18:30:50 +0100 Subject: proj_create_crs_to_crs_from_pj(): add ACCURACY and ALLOW_BALLPARK options --- test/unit/test_c_api.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'test') diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index c417371d..e54c6fa7 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -4196,6 +4196,64 @@ TEST_F(CApi, proj_create_crs_to_crs_from_pj) { // --------------------------------------------------------------------------- +TEST_F(CApi, proj_create_crs_to_crs_from_pj_accuracy_filter) { + + auto src = proj_create(m_ctxt, "EPSG:4326"); // WGS 84 + ObjectKeeper keeper_src(src); + ASSERT_NE(src, nullptr); + + auto dst = proj_create(m_ctxt, "EPSG:4258"); // ETRS89 + ObjectKeeper keeper_dst(dst); + ASSERT_NE(dst, nullptr); + + // No options + { + auto P = + proj_create_crs_to_crs_from_pj(m_ctxt, src, dst, nullptr, nullptr); + ObjectKeeper keeper_P(P); + ASSERT_NE(P, nullptr); + } + + { + const char *const options[] = {"ACCURACY=0.05", nullptr}; + auto P = + proj_create_crs_to_crs_from_pj(m_ctxt, src, dst, nullptr, options); + ObjectKeeper keeper_P(P); + ASSERT_EQ(P, nullptr); + } +} + +// --------------------------------------------------------------------------- + +TEST_F(CApi, proj_create_crs_to_crs_from_pj_ballpark_filter) { + + auto src = proj_create(m_ctxt, "EPSG:4267"); // NAD 27 + ObjectKeeper keeper_src(src); + ASSERT_NE(src, nullptr); + + auto dst = proj_create(m_ctxt, "EPSG:4258"); // ETRS89 + ObjectKeeper keeper_dst(dst); + ASSERT_NE(dst, nullptr); + + // No options + { + auto P = + proj_create_crs_to_crs_from_pj(m_ctxt, src, dst, nullptr, nullptr); + ObjectKeeper keeper_P(P); + ASSERT_NE(P, nullptr); + } + + { + const char *const options[] = {"ALLOW_BALLPARK=NO", nullptr}; + auto P = + proj_create_crs_to_crs_from_pj(m_ctxt, src, dst, nullptr, options); + ObjectKeeper keeper_P(P); + ASSERT_EQ(P, nullptr); + } +} + +// --------------------------------------------------------------------------- + static void check_axis_is_latitude(PJ_CONTEXT *ctx, PJ *cs, int axis_number, const char *unit_name = "degree", -- cgit v1.2.3 From da066800e59dcd5c3bf5e88ccca1bf1762de74dc Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 16 Dec 2020 16:32:13 +0100 Subject: cs2cs: add --no-ballpark and --accuracy options --- test/cli/testvarious | 12 ++++++++++++ test/cli/tv_out.dist | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'test') diff --git a/test/cli/testvarious b/test/cli/testvarious index 82be4992..a121393c 100755 --- a/test/cli/testvarious +++ b/test/cli/testvarious @@ -1021,6 +1021,18 @@ $EXE --authority EPSG -E +proj=latlong +datum=WGS84 +no_defs +to +init=epsg:6342 -105 40 EOF +echo "##############################################################" >> ${OUT} +echo "Test effect of --accuracy" >> ${OUT} +$EXE -E --accuracy 0.05 EPSG:4326 EPSG:4258 >> ${OUT} <> ${OUT} +echo "Test effect of --no-ballpark" >> ${OUT} +$EXE -E --no-ballpark EPSG:4267 EPSG:4258 >> ${OUT} <