From 1c60f4cc408e85aff78482659a80fe974ee5d57b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 2 Feb 2019 09:44:44 +0100 Subject: PROJStringSyntaxParser: avoid assertion on illegal input. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12837. Credit to OSS Fuzz --- test/unit/test_io.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 1bbedc03..157614b4 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -8735,6 +8735,10 @@ TEST(io, projparse_errors) { EXPECT_THROW(PROJStringParser().createFromPROJString( "proj=pipeline step init=epsg:4326 init=epsg:4326"), ParsingException); + + EXPECT_THROW( + PROJStringParser().createFromPROJString("proj=\tinit= +type=crs"), + ParsingException); } // --------------------------------------------------------------------------- -- cgit v1.2.3 From abad23412f0920276c32567c8f237be23aa94941 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 2 Feb 2019 11:25:36 +0100 Subject: pj_ellipsoid(): avoid division by zero when R=0. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12843. Credit to OSS Fuzz --- test/gie/ellipsoid.gie | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/gie/ellipsoid.gie b/test/gie/ellipsoid.gie index 929eb799..ea7f3888 100644 --- a/test/gie/ellipsoid.gie +++ b/test/gie/ellipsoid.gie @@ -64,6 +64,9 @@ expect 0 0 operation proj=merc +es=-1 expect failure errno major_axis_not_given +operation proj=merc +R=0 +expect failure errno major_axis_not_given + operation expect failure operation cobra -- cgit v1.2.3 From b30ed5cba50688cea9ac2af90855177f84efea5a Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 3 Feb 2019 12:23:50 +0100 Subject: labrd: avoid floating point division by zero. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12849. Credit to OSS Fuzz --- test/gie/builtins.gie | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index bc9374a5..82222210 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -2243,6 +2243,10 @@ expect 0.498202281 2.000904357 accept -200 -100 expect 0.498202283 1.999095641 +------------------------------------------------------------------------------- +operation +proj=labrd +ellps=GRS80 +lat_0=0 +accept 0 0 +expect failure errno lat_0_is_zero =============================================================================== Lambert Azimuthal Equal Area -- cgit v1.2.3 From 24c1272cf4397614fb7ea5502bba9258e6a8f972 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 3 Feb 2019 14:48:17 +0100 Subject: WKT1 export: avoid division by zero. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12854. Credit to OSS Fuzz --- test/unit/test_io.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'test') diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 157614b4..69ef9073 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -8965,3 +8965,61 @@ TEST(wkt_export, precision) { WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()), wkt); } + +// --------------------------------------------------------------------------- + +// Avoid division by zero + +TEST(wkt_export, invalid_linear_unit) { + auto wkt = "PROJCS[\"WGS 84 / UTM zone 31N\",\n" + " GEOGCS[\"WGS 84\",\n" + " DATUM[\"WGS_1984\",\n" + " SPHEROID[\"WGS 84\",6378137,298.257223563]],\n" + " PRIMEM[\"Greenwich\",0],\n" + " UNIT[\"degree\",0.0174532925199433]],\n" + " PROJECTION[\"Transverse_Mercator\"],\n" + " PARAMETER[\"latitude_of_origin\",0],\n" + " PARAMETER[\"central_meridian\",3],\n" + " PARAMETER[\"scale_factor\",0.9996],\n" + " PARAMETER[\"false_easting\",500000],\n" + " PARAMETER[\"false_northing\",0],\n" + " UNIT[\"foo\",0]]"; + + auto obj = WKTParser().createFromWKT(wkt); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + + EXPECT_THROW( + crs->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()), + FormattingException); +} + +// --------------------------------------------------------------------------- + +// Avoid division by zero + +TEST(wkt_export, invalid_angular_unit) { + auto wkt = "PROJCS[\"WGS 84 / UTM zone 31N\",\n" + " GEOGCS[\"WGS 84\",\n" + " DATUM[\"WGS_1984\",\n" + " SPHEROID[\"WGS 84\",6378137,298.257223563]],\n" + " PRIMEM[\"Greenwich\",0],\n" + " UNIT[\"foo\",0]],\n" + " PROJECTION[\"Transverse_Mercator\"],\n" + " PARAMETER[\"latitude_of_origin\",0],\n" + " PARAMETER[\"central_meridian\",3],\n" + " PARAMETER[\"scale_factor\",0.9996],\n" + " PARAMETER[\"false_easting\",500000],\n" + " PARAMETER[\"false_northing\",0],\n" + " UNIT[\"meter\",1]]"; + + auto obj = WKTParser().createFromWKT(wkt); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + + EXPECT_THROW( + crs->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()), + FormattingException); +} -- cgit v1.2.3 From e121dc35abafd9a2eda01b05aa5fa13b13e6196e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 3 Feb 2019 15:16:01 +0100 Subject: Avoid division by zero in Ellipsoid::computeSemiMinorAxis(). Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12867. Credit to OSS Fuzz. master only --- test/unit/test_datum.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/unit/test_datum.cpp b/test/unit/test_datum.cpp index 18cf244a..c6ccf5cf 100644 --- a/test/unit/test_datum.cpp +++ b/test/unit/test_datum.cpp @@ -127,6 +127,18 @@ TEST(datum, ellipsoid_from_inverse_flattening) { // --------------------------------------------------------------------------- +TEST(datum, ellipsoid_from_null_inverse_flattening) { + + auto ellipsoid = Ellipsoid::createFlattenedSphere( + PropertyMap(), Length(6378137), Scale(0)); + EXPECT_FALSE(ellipsoid->inverseFlattening().has_value()); + EXPECT_FALSE(ellipsoid->semiMinorAxis().has_value()); + EXPECT_FALSE(ellipsoid->semiMedianAxis().has_value()); + EXPECT_TRUE(ellipsoid->isSphere()); +} + +// --------------------------------------------------------------------------- + TEST(datum, ellipsoid_from_semi_minor_axis) { auto ellipsoid = Ellipsoid::createTwoAxis(PropertyMap(), Length(6378137), -- cgit v1.2.3 From 4abfe10ab7a64552db242aa240bbcf2f92598604 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 3 Feb 2019 16:07:10 +0100 Subject: init(): repair to_meter=num/denom that was broken in the general case in PROJ 5; repair vto_meter=num/denom that was broken, and avoid division by zero, which fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12869. Credit to OSS Fuzz --- test/gie/4D-API_cs2cs-style.gie | 8 ++++++++ test/gie/more_builtins.gie | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'test') diff --git a/test/gie/4D-API_cs2cs-style.gie b/test/gie/4D-API_cs2cs-style.gie index f66b26ec..215971a0 100644 --- a/test/gie/4D-API_cs2cs-style.gie +++ b/test/gie/4D-API_cs2cs-style.gie @@ -348,6 +348,14 @@ accept 0 0 1000 expect 0 0 1 roundtrip 1 +operation +proj=longlat +a=1 +b=1 +vto_meter=2000/2 +accept 0 0 1000 +expect 0 0 1 +roundtrip 1 + +operation +proj=longlat +a=1 +b=1 +vto_meter=1/0 +expect failure errno unit_factor_less_than_0 + operation +proj=longlat +a=1 +b=1 +vto_meter=1000 +geoc accept 0 0 1000 expect 0 0 1 diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie index 44d01385..d1c978a3 100644 --- a/test/gie/more_builtins.gie +++ b/test/gie/more_builtins.gie @@ -496,6 +496,14 @@ expect failure errno unit_factor_less_than_0 operation proj=utm ellps=GRS80 zone=32 to_meter=10 accept 12 55 expect 69187.5632 609890.7825 + +operation proj=utm ellps=GRS80 zone=32 to_meter=1/0 +expect failure errno unit_factor_less_than_0 + +operation proj=utm ellps=GRS80 zone=32 to_meter=2.0/0.2 +accept 12 55 +expect 69187.5632 609890.7825 + ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- cgit v1.2.3 From 322493235696097b94294f5f466a32f015a95626 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Feb 2019 01:33:39 -0500 Subject: Use pkgconfig to find sqlite3. --- test/unit/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index 34624b0d..c0a05997 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -4,7 +4,7 @@ EXTRA_DIST = CMakeLists.txt noinst_HEADERS = gtest_include.h -AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/test -I$(top_srcdir)/test/googletest/include @SQLITE3_FLAGS@ +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/test -I$(top_srcdir)/test/googletest/include @SQLITE3_CFLAGS@ AM_CXXFLAGS = @CXX_WFLAGS@ @NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG@ PROJ_LIB ?= ../../data @@ -49,13 +49,13 @@ proj_context_test-check: proj_context_test ./proj_context_test test_cpp_api_SOURCES = test_util.cpp test_common.cpp test_crs.cpp test_metadata.cpp test_io.cpp test_operation.cpp test_datum.cpp test_factory.cpp test_c_api.cpp main.cpp -test_cpp_api_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la @SQLITE3_LDFLAGS@ +test_cpp_api_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la @SQLITE3_LIBS@ test_cpp_api-check: test_cpp_api PROJ_LIB=$(PROJ_LIB) ./test_cpp_api gie_self_tests_SOURCES = gie_self_tests.cpp main.cpp -gie_self_tests_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la @SQLITE3_LDFLAGS@ +gie_self_tests_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la @SQLITE3_LIBS@ gie_self_tests-check: gie_self_tests PROJ_LIB=$(PROJ_LIB) ./gie_self_tests -- cgit v1.2.3 From 561a6639c45a4e35a638c2e87869c5991fc7d69e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Feb 2019 02:57:38 -0500 Subject: Allow building against external GTest with autotools. --- test/Makefile.am | 5 ++++- test/unit/Makefile.am | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/Makefile.am b/test/Makefile.am index b65e9785..fa2c1e80 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -7,4 +7,7 @@ EXTRA_DIST = CMakeLists.txt # libtestmain_la_LDFLAGS = -no-undefined # libtestmain_la_SOURCES = test_main.cpp -SUBDIRS = cli googletest . gie gigs unit +if !USE_EXTERNAL_GTEST +MAYBE_GTEST = googletest +endif +SUBDIRS = cli $(MAYBE_GTEST) . gie gigs unit diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index c0a05997..210bdc90 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -4,7 +4,7 @@ EXTRA_DIST = CMakeLists.txt noinst_HEADERS = gtest_include.h -AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/test -I$(top_srcdir)/test/googletest/include @SQLITE3_CFLAGS@ +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/test @GTEST_CFLAGS@ @SQLITE3_CFLAGS@ AM_CXXFLAGS = @CXX_WFLAGS@ @NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG@ PROJ_LIB ?= ../../data @@ -19,43 +19,43 @@ noinst_PROGRAMS += gie_self_tests noinst_PROGRAMS += include_proj_h_from_c pj_transform_test_SOURCES = pj_transform_test.cpp main.cpp -pj_transform_test_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la +pj_transform_test_LDADD = ../../src/libproj.la @GTEST_LIBS@ pj_transform_test-check: pj_transform_test PROJ_LIB=$(PROJ_LIB) ./pj_transform_test pj_phi2_test_SOURCES = pj_phi2_test.cpp main.cpp -pj_phi2_test_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la +pj_phi2_test_LDADD = ../../src/libproj.la @GTEST_LIBS@ pj_phi2_test-check: pj_phi2_test ./pj_phi2_test proj_errno_string_test_SOURCES = proj_errno_string_test.cpp main.cpp -proj_errno_string_test_LDADD= ../../src/libproj.la ../../test/googletest/libgtest.la +proj_errno_string_test_LDADD= ../../src/libproj.la @GTEST_LIBS@ proj_errno_string_test-check: proj_errno_string_test ./proj_errno_string_test proj_angular_io_test_SOURCES = proj_angular_io_test.cpp main.cpp -proj_angular_io_test_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la +proj_angular_io_test_LDADD = ../../src/libproj.la @GTEST_LIBS@ proj_angular_io_test-check: proj_angular_io_test ./proj_angular_io_test proj_context_test_SOURCES = proj_context_test.cpp main.cpp -proj_context_test_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la +proj_context_test_LDADD = ../../src/libproj.la @GTEST_LIBS@ proj_context_test-check: proj_context_test ./proj_context_test test_cpp_api_SOURCES = test_util.cpp test_common.cpp test_crs.cpp test_metadata.cpp test_io.cpp test_operation.cpp test_datum.cpp test_factory.cpp test_c_api.cpp main.cpp -test_cpp_api_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la @SQLITE3_LIBS@ +test_cpp_api_LDADD = ../../src/libproj.la @GTEST_LIBS@ @SQLITE3_LIBS@ test_cpp_api-check: test_cpp_api PROJ_LIB=$(PROJ_LIB) ./test_cpp_api gie_self_tests_SOURCES = gie_self_tests.cpp main.cpp -gie_self_tests_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la @SQLITE3_LIBS@ +gie_self_tests_LDADD = ../../src/libproj.la @GTEST_LIBS@ @SQLITE3_LIBS@ gie_self_tests-check: gie_self_tests PROJ_LIB=$(PROJ_LIB) ./gie_self_tests -- cgit v1.2.3 From 7c9e460a4a8115553e6e4c71872bc2df1a45fb94 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Feb 2019 03:21:09 -0500 Subject: Allow building against external GTest with CMake. --- test/unit/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index a157f630..86e3484a 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -1,5 +1,16 @@ # CMake configuration for PROJ unit tests +option(USE_EXTERNAL_GTEST "Compile against external GTest" OFF) + +if (USE_EXTERNAL_GTEST) + +message(STATUS "Using external GTest") +find_package(GTest 1.8.0) + +else (USE_EXTERNAL_GTEST) + +message(STATUS "Using internal GTest") + # FIXME: Deal with our old-school CMakeLists.txt behaving badly set(_save_c_flags "${CMAKE_C_FLAGS}") set(_save_cxx_flags "${CMAKE_CXX_FLAGS}") @@ -47,6 +58,8 @@ set(CMAKE_CXX_FLAGS "${_save_cxx_flags}") unset(_save_c_flags) unset(_save_cxx_flags) +endif(USE_EXTERNAL_GTEST) + # # Build PROJ unit tests # -- cgit v1.2.3 From 457b173cbe8fdb790b011d1828a0fd9f8f6221a4 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 6 Feb 2019 14:26:06 +0100 Subject: ISO19111: Handle database area objects with no bounding box --- test/unit/test_factory.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/unit/test_factory.cpp b/test/unit/test_factory.cpp index 81f745f5..95436c75 100644 --- a/test/unit/test_factory.cpp +++ b/test/unit/test_factory.cpp @@ -222,6 +222,16 @@ TEST(factory, AuthorityFactory_createExtent) { // --------------------------------------------------------------------------- +TEST(factory, AuthorityFactory_createExtent_no_bbox) { + auto factory = AuthorityFactory::create(DatabaseContext::create(), "EPSG"); + auto extent = factory->createExtent("1361"); // Sudan - south. Deprecated + EXPECT_EQ(*(extent->description()), "Sudan - south"); + const auto &geogElts = extent->geographicElements(); + EXPECT_TRUE(geogElts.empty()); +} + +// --------------------------------------------------------------------------- + TEST(factory, AuthorityFactory_createGeodeticDatum) { auto factory = AuthorityFactory::create(DatabaseContext::create(), "EPSG"); EXPECT_THROW(factory->createGeodeticDatum("-1"), @@ -414,6 +424,17 @@ TEST(factory, AuthorityFactory_createGeodeticCRS_geographic2D) { // --------------------------------------------------------------------------- +TEST(factory, AuthorityFactory_createGeodeticCRS_geographic2D_area_no_bbox) { + auto factory = AuthorityFactory::create(DatabaseContext::create(), "EPSG"); + auto crs = factory->createGeodeticCRS("4296"); // Sudan - deprecated + auto domain = crs->domains()[0]; + auto extent = domain->domainOfValidity(); + ASSERT_TRUE(extent != nullptr); + EXPECT_TRUE(extent->isEquivalentTo(factory->createExtent("1361").get())); +} + +// --------------------------------------------------------------------------- + TEST(factory, AuthorityFactory_createGeodeticCRS_geographic3D) { auto factory = AuthorityFactory::create(DatabaseContext::create(), "EPSG"); auto crs = factory->createGeodeticCRS("4979"); -- cgit v1.2.3 From 02efe72181814097284196de9b9b984db0fb3d26 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 6 Feb 2019 18:32:58 +0100 Subject: Add proj_get_crs_info_list_from_database() This method is intended to be used typically by GUI that lists all possible CRS. What is does could be done by previously existing functions, but it is much faster. It typically runs in less than 0.1s (hot run) versus ~0.5s with the method that consists in enumerating all codes and instanciating a PJ object for each of them. --- test/unit/test_c_api.cpp | 206 +++++++++++++++++++++++++++++++++++++++++++++ test/unit/test_factory.cpp | 99 ++++++++++++++++++++++ 2 files changed, 305 insertions(+) (limited to 'test') diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index ff29185f..be43f715 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -3022,4 +3022,210 @@ TEST_F(CApi, proj_create_cartesian_2D_cs) { } } +// --------------------------------------------------------------------------- + +TEST_F(CApi, proj_get_crs_info_list_from_database) { + { proj_crs_list_destroy(nullptr); } + + { proj_get_crs_list_parameters_destroy(nullptr); } + + // All null parameters + { + auto list = proj_get_crs_info_list_from_database(nullptr, nullptr, + nullptr, nullptr); + ASSERT_NE(list, nullptr); + ASSERT_NE(list[0], nullptr); + EXPECT_NE(list[0]->auth_name, nullptr); + EXPECT_NE(list[0]->code, nullptr); + EXPECT_NE(list[0]->name, nullptr); + proj_crs_list_destroy(list); + } + + // Default parameters + { + int result_count = 0; + auto params = proj_get_crs_list_parameters_create(); + auto list = proj_get_crs_info_list_from_database(m_ctxt, "EPSG", params, + &result_count); + proj_get_crs_list_parameters_destroy(params); + ASSERT_NE(list, nullptr); + EXPECT_GT(result_count, 1); + EXPECT_EQ(list[result_count], nullptr); + bool found4326 = false; + bool found4978 = false; + bool found4979 = false; + bool found32631 = false; + bool found3855 = false; + bool found3901 = false; + for (int i = 0; i < result_count; i++) { + auto code = std::string(list[i]->code); + if (code == "4326") { + found4326 = true; + EXPECT_EQ(std::string(list[i]->auth_name), "EPSG"); + EXPECT_EQ(std::string(list[i]->name), "WGS 84"); + EXPECT_EQ(list[i]->type, PJ_TYPE_GEOGRAPHIC_2D_CRS); + EXPECT_EQ(list[i]->deprecated, 0); + EXPECT_EQ(list[i]->bbox_valid, 1); + EXPECT_EQ(list[i]->west_lon_degree, -180.0); + EXPECT_EQ(list[i]->south_lat_degree, -90.0); + EXPECT_EQ(list[i]->east_lon_degree, 180.0); + EXPECT_EQ(list[i]->north_lat_degree, 90.0); + EXPECT_EQ(std::string(list[i]->area_name), "World"); + EXPECT_EQ(list[i]->projection_method_name, nullptr); + } else if (code == "4978") { + found4978 = true; + EXPECT_EQ(list[i]->type, PJ_TYPE_GEOCENTRIC_CRS); + } else if (code == "4979") { + found4979 = true; + EXPECT_EQ(list[i]->type, PJ_TYPE_GEOGRAPHIC_3D_CRS); + } else if (code == "32631") { + found32631 = true; + EXPECT_EQ(list[i]->type, PJ_TYPE_PROJECTED_CRS); + EXPECT_EQ(std::string(list[i]->projection_method_name), + "Transverse Mercator"); + } else if (code == "3855") { + found3855 = true; + EXPECT_EQ(list[i]->type, PJ_TYPE_VERTICAL_CRS); + } else if (code == "3901") { + found3901 = true; + EXPECT_EQ(list[i]->type, PJ_TYPE_COMPOUND_CRS); + } + EXPECT_EQ(list[i]->deprecated, 0); + } + EXPECT_TRUE(found4326); + EXPECT_TRUE(found4978); + EXPECT_TRUE(found4979); + EXPECT_TRUE(found32631); + EXPECT_TRUE(found3855); + EXPECT_TRUE(found3901); + proj_crs_list_destroy(list); + } + + // Filter on only geodetic crs + { + int result_count = 0; + auto params = proj_get_crs_list_parameters_create(); + params->typesCount = 1; + auto type = PJ_TYPE_GEODETIC_CRS; + params->types = &type; + auto list = proj_get_crs_info_list_from_database(m_ctxt, "EPSG", params, + &result_count); + bool foundGeog2D = false; + bool foundGeog3D = false; + bool foundGeocentric = false; + for (int i = 0; i < result_count; i++) { + foundGeog2D |= list[i]->type == PJ_TYPE_GEOGRAPHIC_2D_CRS; + foundGeog3D |= list[i]->type == PJ_TYPE_GEOGRAPHIC_3D_CRS; + foundGeocentric |= list[i]->type == PJ_TYPE_GEOCENTRIC_CRS; + EXPECT_TRUE(list[i]->type == PJ_TYPE_GEOGRAPHIC_2D_CRS || + list[i]->type == PJ_TYPE_GEOGRAPHIC_3D_CRS || + list[i]->type == PJ_TYPE_GEOCENTRIC_CRS); + } + EXPECT_TRUE(foundGeog2D); + EXPECT_TRUE(foundGeog3D); + EXPECT_TRUE(foundGeocentric); + proj_get_crs_list_parameters_destroy(params); + proj_crs_list_destroy(list); + } + + // Filter on only geographic crs + { + int result_count = 0; + auto params = proj_get_crs_list_parameters_create(); + params->typesCount = 1; + auto type = PJ_TYPE_GEOGRAPHIC_CRS; + params->types = &type; + auto list = proj_get_crs_info_list_from_database(m_ctxt, "EPSG", params, + &result_count); + bool foundGeog2D = false; + bool foundGeog3D = false; + for (int i = 0; i < result_count; i++) { + foundGeog2D |= list[i]->type == PJ_TYPE_GEOGRAPHIC_2D_CRS; + foundGeog3D |= list[i]->type == PJ_TYPE_GEOGRAPHIC_3D_CRS; + EXPECT_TRUE(list[i]->type == PJ_TYPE_GEOGRAPHIC_2D_CRS || + list[i]->type == PJ_TYPE_GEOGRAPHIC_3D_CRS); + } + EXPECT_TRUE(foundGeog2D); + EXPECT_TRUE(foundGeog3D); + proj_get_crs_list_parameters_destroy(params); + proj_crs_list_destroy(list); + } + + // Filter on only geographic 2D crs and projected CRS + { + int result_count = 0; + auto params = proj_get_crs_list_parameters_create(); + params->typesCount = 2; + const PJ_TYPE types[] = {PJ_TYPE_GEOGRAPHIC_2D_CRS, + PJ_TYPE_PROJECTED_CRS}; + params->types = types; + auto list = proj_get_crs_info_list_from_database(m_ctxt, "EPSG", params, + &result_count); + bool foundGeog2D = false; + bool foundProjected = false; + for (int i = 0; i < result_count; i++) { + foundGeog2D |= list[i]->type == PJ_TYPE_GEOGRAPHIC_2D_CRS; + foundProjected |= list[i]->type == PJ_TYPE_PROJECTED_CRS; + EXPECT_TRUE(list[i]->type == PJ_TYPE_GEOGRAPHIC_2D_CRS || + list[i]->type == PJ_TYPE_PROJECTED_CRS); + } + EXPECT_TRUE(foundGeog2D); + EXPECT_TRUE(foundProjected); + proj_get_crs_list_parameters_destroy(params); + proj_crs_list_destroy(list); + } + + // Filter on bbox (inclusion) + { + int result_count = 0; + auto params = proj_get_crs_list_parameters_create(); + params->bbox_valid = 1; + params->west_lon_degree = 2; + params->south_lat_degree = 49; + params->east_lon_degree = 2.1; + params->north_lat_degree = 49.1; + params->typesCount = 1; + auto type = PJ_TYPE_PROJECTED_CRS; + params->types = &type; + auto list = proj_get_crs_info_list_from_database(m_ctxt, "EPSG", params, + &result_count); + ASSERT_NE(list, nullptr); + EXPECT_GT(result_count, 1); + for (int i = 0; i < result_count; i++) { + EXPECT_LE(list[i]->west_lon_degree, params->west_lon_degree); + EXPECT_LE(list[i]->south_lat_degree, params->south_lat_degree); + EXPECT_GE(list[i]->east_lon_degree, params->east_lon_degree); + EXPECT_GE(list[i]->north_lat_degree, params->north_lat_degree); + } + proj_get_crs_list_parameters_destroy(params); + proj_crs_list_destroy(list); + } + + // Filter on bbox (intersection) + { + int result_count = 0; + auto params = proj_get_crs_list_parameters_create(); + params->bbox_valid = 1; + params->west_lon_degree = 2; + params->south_lat_degree = 49; + params->east_lon_degree = 2.1; + params->north_lat_degree = 49.1; + params->crs_area_of_use_contains_bbox = 0; + params->typesCount = 1; + auto type = PJ_TYPE_PROJECTED_CRS; + params->types = &type; + auto list = proj_get_crs_info_list_from_database(m_ctxt, "EPSG", params, + &result_count); + ASSERT_NE(list, nullptr); + EXPECT_GT(result_count, 1); + for (int i = 0; i < result_count; i++) { + EXPECT_LE(list[i]->west_lon_degree, params->east_lon_degree); + EXPECT_LE(list[i]->south_lat_degree, params->north_lat_degree); + EXPECT_GE(list[i]->east_lon_degree, params->west_lon_degree); + EXPECT_GE(list[i]->north_lat_degree, params->south_lat_degree); + } + proj_get_crs_list_parameters_destroy(params); + proj_crs_list_destroy(list); + } +} } // namespace diff --git a/test/unit/test_factory.cpp b/test/unit/test_factory.cpp index 95436c75..ce019079 100644 --- a/test/unit/test_factory.cpp +++ b/test/unit/test_factory.cpp @@ -2810,4 +2810,103 @@ TEST(factory, listAreaOfUseFromName) { } } +// --------------------------------------------------------------------------- + +TEST(factory, getCRSInfoList) { + auto ctxt = DatabaseContext::create(); + { + auto factory = AuthorityFactory::create(ctxt, std::string()); + auto list = factory->getCRSInfoList(); + EXPECT_GT(list.size(), 1U); + bool foundEPSG = false; + bool foundIGNF = true; + bool found4326 = false; + for (const auto &info : list) { + foundEPSG |= info.authName == "EPSG"; + foundIGNF |= info.authName == "IGNF"; + if (info.authName == "EPSG" && info.code == "4326") { + found4326 = true; + } + } + EXPECT_TRUE(foundEPSG); + EXPECT_TRUE(foundIGNF); + EXPECT_TRUE(found4326); + } + { + auto factory = AuthorityFactory::create(ctxt, "EPSG"); + auto list = factory->getCRSInfoList(); + EXPECT_GT(list.size(), 1U); + bool found4326 = false; + bool found4978 = false; + bool found4979 = false; + bool found32631 = false; + bool found3855 = false; + bool found6871 = false; + for (const auto &info : list) { + EXPECT_EQ(info.authName, "EPSG"); + if (info.code == "4326") { + EXPECT_EQ(info.name, "WGS 84"); + EXPECT_EQ(info.type, + AuthorityFactory::ObjectType::GEOGRAPHIC_2D_CRS); + EXPECT_EQ(info.deprecated, false); + EXPECT_EQ(info.bbox_valid, true); + EXPECT_EQ(info.west_lon_degree, -180.0); + EXPECT_EQ(info.south_lat_degree, -90.0); + EXPECT_EQ(info.east_lon_degree, 180.0); + EXPECT_EQ(info.north_lat_degree, 90.0); + EXPECT_EQ(info.areaName, "World"); + EXPECT_TRUE(info.projectionMethodName.empty()); + found4326 = true; + } else if (info.code == "4296") { // Soudan - deprecated + EXPECT_EQ(info.bbox_valid, false); + EXPECT_EQ(info.west_lon_degree, 0.0); + EXPECT_EQ(info.south_lat_degree, 0.0); + EXPECT_EQ(info.east_lon_degree, 0.0); + EXPECT_EQ(info.north_lat_degree, 0.0); + } else if (info.code == "4978") { + EXPECT_EQ(info.name, "WGS 84"); + EXPECT_EQ(info.type, + AuthorityFactory::ObjectType::GEOCENTRIC_CRS); + found4978 = true; + } else if (info.code == "4979") { + EXPECT_EQ(info.name, "WGS 84"); + EXPECT_EQ(info.type, + AuthorityFactory::ObjectType::GEOGRAPHIC_3D_CRS); + found4979 = true; + } else if (info.code == "32631") { + EXPECT_EQ(info.name, "WGS 84 / UTM zone 31N"); + EXPECT_EQ(info.type, + AuthorityFactory::ObjectType::PROJECTED_CRS); + EXPECT_EQ(info.deprecated, false); + EXPECT_EQ(info.bbox_valid, true); + EXPECT_EQ(info.west_lon_degree, 0.0); + EXPECT_EQ(info.south_lat_degree, 0.0); + EXPECT_EQ(info.east_lon_degree, 6.0); + EXPECT_EQ(info.north_lat_degree, 84.0); + EXPECT_EQ(info.areaName, "World - N hemisphere - 0\xC2\xB0" + "E to 6\xC2\xB0" + "E - by country"); + EXPECT_EQ(info.projectionMethodName, "Transverse Mercator"); + found32631 = true; + } else if (info.code == "3855") { + EXPECT_EQ(info.name, "EGM2008 height"); + EXPECT_EQ(info.type, + AuthorityFactory::ObjectType::VERTICAL_CRS); + found3855 = true; + } else if (info.code == "6871") { + EXPECT_EQ(info.name, + "WGS 84 / Pseudo-Mercator + EGM2008 geoid height"); + EXPECT_EQ(info.type, + AuthorityFactory::ObjectType::COMPOUND_CRS); + found6871 = true; + } + } + EXPECT_TRUE(found4326); + EXPECT_TRUE(found4978); + EXPECT_TRUE(found4979); + EXPECT_TRUE(found32631); + EXPECT_TRUE(found3855); + EXPECT_TRUE(found6871); + } +} } // namespace -- cgit v1.2.3 From 96fe92361156c0b242301dd8cb56115cec243af4 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 7 Feb 2019 15:05:31 +0100 Subject: Rename proj_crs_list_destroy() to proj_crs_info_list_destroy() --- test/unit/test_c_api.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index be43f715..8ef426ac 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -3025,7 +3025,7 @@ TEST_F(CApi, proj_create_cartesian_2D_cs) { // --------------------------------------------------------------------------- TEST_F(CApi, proj_get_crs_info_list_from_database) { - { proj_crs_list_destroy(nullptr); } + { proj_crs_info_list_destroy(nullptr); } { proj_get_crs_list_parameters_destroy(nullptr); } @@ -3038,7 +3038,7 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { EXPECT_NE(list[0]->auth_name, nullptr); EXPECT_NE(list[0]->code, nullptr); EXPECT_NE(list[0]->name, nullptr); - proj_crs_list_destroy(list); + proj_crs_info_list_destroy(list); } // Default parameters @@ -3098,7 +3098,7 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { EXPECT_TRUE(found32631); EXPECT_TRUE(found3855); EXPECT_TRUE(found3901); - proj_crs_list_destroy(list); + proj_crs_info_list_destroy(list); } // Filter on only geodetic crs @@ -3125,7 +3125,7 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { EXPECT_TRUE(foundGeog3D); EXPECT_TRUE(foundGeocentric); proj_get_crs_list_parameters_destroy(params); - proj_crs_list_destroy(list); + proj_crs_info_list_destroy(list); } // Filter on only geographic crs @@ -3148,7 +3148,7 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { EXPECT_TRUE(foundGeog2D); EXPECT_TRUE(foundGeog3D); proj_get_crs_list_parameters_destroy(params); - proj_crs_list_destroy(list); + proj_crs_info_list_destroy(list); } // Filter on only geographic 2D crs and projected CRS @@ -3172,7 +3172,7 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { EXPECT_TRUE(foundGeog2D); EXPECT_TRUE(foundProjected); proj_get_crs_list_parameters_destroy(params); - proj_crs_list_destroy(list); + proj_crs_info_list_destroy(list); } // Filter on bbox (inclusion) @@ -3198,7 +3198,7 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { EXPECT_GE(list[i]->north_lat_degree, params->north_lat_degree); } proj_get_crs_list_parameters_destroy(params); - proj_crs_list_destroy(list); + proj_crs_info_list_destroy(list); } // Filter on bbox (intersection) @@ -3225,7 +3225,7 @@ TEST_F(CApi, proj_get_crs_info_list_from_database) { EXPECT_GE(list[i]->north_lat_degree, params->south_lat_degree); } proj_get_crs_list_parameters_destroy(params); - proj_crs_list_destroy(list); + proj_crs_info_list_destroy(list); } } } // namespace -- cgit v1.2.3 From 593fcc4b57d0f5c3a46134add142ee8d9316aec6 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 11 Feb 2019 22:11:32 +0100 Subject: test/cli/testcct: add minimalistic test of cct --- test/cli/Makefile.am | 9 +++++++-- test/cli/testcct | 51 +++++++++++++++++++++++++++++++++++++++++++++++ test/cli/testcct_out.dist | 3 +++ 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100755 test/cli/testcct create mode 100644 test/cli/testcct_out.dist (limited to 'test') diff --git a/test/cli/Makefile.am b/test/cli/Makefile.am index 50654968..9a8c7d5e 100644 --- a/test/cli/Makefile.am +++ b/test/cli/Makefile.am @@ -5,6 +5,7 @@ EXEPATH = ../../src PROJEXE = $(EXEPATH)/proj CS2CSEXE = $(EXEPATH)/cs2cs PROJINFOEXE = $(EXEPATH)/projinfo +CCTEXE = $(EXEPATH)/cct # PROJ.4 test scripts TEST27 = $(THIS_DIR)/test27 @@ -15,12 +16,13 @@ TESTFLAKY = $(THIS_DIR)/testflaky TESTDATUMFILE = $(THIS_DIR)/testdatumfile TESTIGN = $(THIS_DIR)/testIGNF TESTPROJINFO = $(THIS_DIR)/testprojinfo +TESTCCT = $(THIS_DIR)/testcct EXTRA_DIST = pj_out27.dist pj_out83.dist td_out.dist \ test27 test83 tv_out.dist tf_out.dist \ testflaky testvarious testdatumfile testntv2 ntv2_out.dist \ testIGNF proj_outIGNF.dist \ - testprojinfo testprojinfo_out.dist \ + testprojinfo testprojinfo_out.dist testcct_out.dist \ CMakeLists.txt testprojinfo-check: @@ -50,4 +52,7 @@ testntv2-check: PROJ_LIB=$(DATAPATH) $(TESTNTV2) $(CS2CSEXE) ; \ fi -check-local: testprojinfo-check test27-check test83-check testvarious-check testdatumfile-check testign-check testntv2-check +testcct-check: + PROJ_LIB=$(DATAPATH) $(TESTCCT) $(CCTEXT) + +check-local: testprojinfo-check test27-check test83-check testvarious-check testdatumfile-check testign-check testntv2-check testcct-check diff --git a/test/cli/testcct b/test/cli/testcct new file mode 100755 index 00000000..93749052 --- /dev/null +++ b/test/cli/testcct @@ -0,0 +1,51 @@ +: +# Test cct + +TEST_CLI_DIR=`dirname $0` +DATA_DIR=`dirname $0`/../../data +EXE=$1 + +usage() +{ + echo "Usage: ${0} " + echo + exit 1 +} + +if test -z "${EXE}"; then + EXE=../../src/cct +fi + +if test ! -x ${EXE}; then + echo "*** ERROR: Can not find '${EXE}' program!" + exit 1 +fi + +echo "============================================" +echo "Running ${0} using ${EXE}:" +echo "============================================" + +OUT=testcct_out + +rm -f ${OUT} + +echo "Testing cct -d 8 +proj=merc +R=1" >> ${OUT} +echo "90 45" 0 | $EXE -d 8 +proj=merc +R=1 >>${OUT} +echo "" >>${OUT} + +# do 'diff' with distribution results +echo "diff ${OUT} with testcct_out.dist" +diff -u ${OUT} ${TEST_CLI_DIR}/testcct_out.dist +if [ $? -ne 0 ] ; then + echo "" + echo "PROBLEMS HAVE OCCURRED" + echo "test file ${OUT} saved" + echo + exit 100 +else + echo "TEST OK" + echo "test file ${OUT} removed" + echo + /bin/rm -f ${OUT} + exit 0 +fi diff --git a/test/cli/testcct_out.dist b/test/cli/testcct_out.dist new file mode 100644 index 00000000..44dd6964 --- /dev/null +++ b/test/cli/testcct_out.dist @@ -0,0 +1,3 @@ +Testing cct -d 8 +proj=merc +R=1 + 1.57079633 0.88137359 0.00000000 inf + -- cgit v1.2.3 From 5141b3908e59a26c9fe66de94bb7388bff741b58 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Mon, 11 Feb 2019 23:58:16 +0100 Subject: Make tmerc an alias for etmerc. (#1234) * Make tmerc an alias for etmerc This switches the algorithm used in tmerc to the Poder/Engsager tmerc algorithm. The original tmerc algorithm of Evenden/Snyder origin can still be accessed by adding the +approx flag when initializing a tmerc projection. The +approx flag can also be used when initializing UTM projections, in which case the Evenden/Snyder algorithm is used as well. If a tmerc projection is instantiated on a spherical earth the Evenden/Snyder algorithm is used as well since the Poder/Engsager algorithm is only defined on the ellipsoid. +proj=etmerc can still be instantiated for backwards compatibility reasons. Co-authored-by: Kristian Evers Co-authored-by: Even Rouault --- test/cli/testvarious | 4 ++-- test/cli/tv_out.dist | 2 +- test/gie/builtins.gie | 10 ++++++++++ test/unit/test_c_api.cpp | 21 +++------------------ test/unit/test_io.cpp | 31 +++++++++++++++++++++++++++++-- test/unit/test_operation.cpp | 16 ++++++++-------- 6 files changed, 53 insertions(+), 31 deletions(-) (limited to 'test') diff --git a/test/cli/testvarious b/test/cli/testvarious index 7ec50bb3..c1fa61df 100755 --- a/test/cli/testvarious +++ b/test/cli/testvarious @@ -239,7 +239,7 @@ EOF echo "##############################################################" >> ${OUT} echo "Test transverse mercator (#97)" >> ${OUT} # -$EXE +proj=tmerc +k=0.998 +lon_0=-20 +datum=WGS84 +x_0=10000 +y_0=20000 \ +$EXE +proj=tmerc +approx +k=0.998 +lon_0=-20 +datum=WGS84 +x_0=10000 +y_0=20000 \ +to +proj=latlong +datum=WGS84 \ -E >>${OUT} <> ${OUT} echo "Test transverse mercator inverse (#97)" >> ${OUT} # $EXE +proj=latlong +datum=WGS84 \ - +to +proj=tmerc +k=0.998 +lon_0=-20 +datum=WGS84 +x_0=10000 +y_0=20000 \ + +to +proj=tmerc +approx +k=0.998 +lon_0=-20 +datum=WGS84 +x_0=10000 +y_0=20000 \ -E >>${OUT} <exportToPROJString( PROJStringFormatter::create(PROJStringFormatter::Convention::PROJ_4) .get()), - "+proj=etmerc +lat_0=0 +lon_0=0 +k=1 +x_0=0 +y_0=0 " + "+proj=tmerc +lat_0=0 +lon_0=0 +k=1 +x_0=0 +y_0=0 " "+datum=WGS84 +units=m +no_defs +type=crs"); auto wkt1 = crs->exportToWKT( WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()); - EXPECT_TRUE(wkt1.find("EXTENSION[\"PROJ4\",\"+proj=etmerc +lat_0=0 " + EXPECT_TRUE(wkt1.find("EXTENSION[\"PROJ4\"") == std::string::npos) + << wkt1; +} + +// --------------------------------------------------------------------------- + +TEST(io, projparse_tmerc_approx) { + auto obj = + PROJStringParser().createFromPROJString("+proj=tmerc +approx +type=crs"); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + auto wkt2 = crs->exportToWKT( + &WKTFormatter::create()->simulCurNodeHasId().setMultiLine(false)); + EXPECT_TRUE( + wkt2.find("METHOD[\"Transverse Mercator\",ID[\"EPSG\",9807]]") != + std::string::npos) + << wkt2; + + EXPECT_EQ( + crs->exportToPROJString( + PROJStringFormatter::create(PROJStringFormatter::Convention::PROJ_4) + .get()), + "+proj=tmerc +approx +lat_0=0 +lon_0=0 +k=1 +x_0=0 +y_0=0 " + "+datum=WGS84 +units=m +no_defs +type=crs"); + + auto wkt1 = crs->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()); + EXPECT_TRUE(wkt1.find("EXTENSION[\"PROJ4\",\"+proj=tmerc +approx +lat_0=0 " "+lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m " "+no_defs\"]") != std::string::npos) << wkt1; diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 6c1ecf1c..586226e2 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -1237,9 +1237,9 @@ TEST(operation, tmerc_export) { { auto formatter = PROJStringFormatter::create(); - formatter->setUseETMercForTMerc(true); + formatter->setUseApproxTMerc(true); EXPECT_EQ(conv->exportToPROJString(formatter.get()), - "+proj=etmerc +lat_0=1 +lon_0=2 +k=3 +x_0=4 +y_0=5"); + "+proj=tmerc +approx +lat_0=1 +lon_0=2 +k=3 +x_0=4 +y_0=5"); } EXPECT_EQ(conv->exportToWKT(WKTFormatter::create().get()), @@ -6061,21 +6061,21 @@ TEST(operation, compoundCRS_to_compoundCRS_with_vertical_transform) { "+ellps=WGS84"); { auto formatter = PROJStringFormatter::create(); - formatter->setUseETMercForTMerc(true); + formatter->setUseApproxTMerc(true); EXPECT_EQ(op->exportToPROJString(formatter.get()), - "+proj=pipeline +step +inv +proj=etmerc +lat_0=1 +lon_0=2 " + "+proj=pipeline +step +inv +proj=tmerc +approx +lat_0=1 +lon_0=2 " "+k=3 +x_0=4 +y_0=5 +ellps=WGS84 +step " "+proj=vgridshift +grids=bla.gtx +multiplier=0.001 +step " - "+proj=utm +zone=32 " + "+proj=utm +approx +zone=32 " "+ellps=WGS84"); } { auto formatter = PROJStringFormatter::create(); - formatter->setUseETMercForTMerc(true); + formatter->setUseApproxTMerc(true); EXPECT_EQ(op->inverse()->exportToPROJString(formatter.get()), - "+proj=pipeline +step +inv +proj=utm +zone=32 +ellps=WGS84 " + "+proj=pipeline +step +inv +proj=utm +approx +zone=32 +ellps=WGS84 " "+step +inv +proj=vgridshift +grids=bla.gtx " - "+multiplier=0.001 +step +proj=etmerc +lat_0=1 +lon_0=2 " + "+multiplier=0.001 +step +proj=tmerc +approx +lat_0=1 +lon_0=2 " "+k=3 +x_0=4 +y_0=5 +ellps=WGS84"); } -- cgit v1.2.3 From 574eef1bdb2b7a3f1bde9c485b94378288d0cf08 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 12 Feb 2019 09:37:20 +0100 Subject: Fix build failure --- test/cli/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/cli/Makefile.am b/test/cli/Makefile.am index 9a8c7d5e..46359807 100644 --- a/test/cli/Makefile.am +++ b/test/cli/Makefile.am @@ -22,7 +22,8 @@ EXTRA_DIST = pj_out27.dist pj_out83.dist td_out.dist \ test27 test83 tv_out.dist tf_out.dist \ testflaky testvarious testdatumfile testntv2 ntv2_out.dist \ testIGNF proj_outIGNF.dist \ - testprojinfo testprojinfo_out.dist testcct_out.dist \ + testprojinfo testprojinfo_out.dist \ + testcct testcct_out.dist \ CMakeLists.txt testprojinfo-check: -- cgit v1.2.3 From 94f0d87714a86385a0102f1cbd086f888475912f Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 12 Feb 2019 09:47:29 +0100 Subject: Fix typo --- test/cli/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/cli/Makefile.am b/test/cli/Makefile.am index 46359807..c0bc0871 100644 --- a/test/cli/Makefile.am +++ b/test/cli/Makefile.am @@ -54,6 +54,6 @@ testntv2-check: fi testcct-check: - PROJ_LIB=$(DATAPATH) $(TESTCCT) $(CCTEXT) + PROJ_LIB=$(DATAPATH) $(TESTCCT) $(CCTEXE) check-local: testprojinfo-check test27-check test83-check testvarious-check testdatumfile-check testign-check testntv2-check testcct-check -- cgit v1.2.3