From a8fdadfa3f726d110bdb964b3952d8c50a8d2f28 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 15 Apr 2020 23:49:54 +0200 Subject: Map ESRI WKT for Adams_Square_II to +proj=adams_ws2 --- test/unit/test_operation.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 99e05dd1..bddbad4a 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -4195,6 +4195,29 @@ TEST(operation, laborde_oblique_mercator) { // --------------------------------------------------------------------------- +TEST(operation, adams_ws2_export) { + auto dbContext = DatabaseContext::create(); + // ESRI:54098 WGS_1984_Adams_Square_II + auto crs = AuthorityFactory::create(dbContext, "ESRI") + ->createProjectedCRS("54098"); + EXPECT_EQ(crs->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=adams_ws2 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m " + "+no_defs +type=crs"); +} + +// --------------------------------------------------------------------------- + +TEST(operation, adams_ws2_export_failure) { + auto dbContext = DatabaseContext::create(); + // ESRI:54099 WGS_1984_Spilhaus_Ocean_Map_in_Square + auto crs = AuthorityFactory::create(dbContext, "ESRI") + ->createProjectedCRS("54099"); + EXPECT_THROW(crs->exportToPROJString(PROJStringFormatter::create().get()), + FormattingException); +} + +// --------------------------------------------------------------------------- + TEST(operation, PROJ_based) { auto conv = SingleOperation::createPROJBased(PropertyMap(), "+proj=merc", nullptr, nullptr); -- cgit v1.2.3 From 0cd2912037001129ba19a50a70ff4bf28a431082 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 15 Apr 2020 23:50:39 +0200 Subject: Implement an iterative inverse method for +proj=adams_ws2 --- test/gie/adams_ws2.gie | 59 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/gie/adams_ws2.gie b/test/gie/adams_ws2.gie index b6aafee7..134148da 100644 --- a/test/gie/adams_ws2.gie +++ b/test/gie/adams_ws2.gie @@ -1,7 +1,8 @@ ------------------------------------------------------------ -This gie file was automatically generated using libproject -where the adams_ws2 code was adapted from +This gie file was initially generated from "random" test points +got by using libproject where the adams_ws2 code was adapted from +It can be edited. ------------------------------------------------------------ ------------------------------------------------------------ @@ -2117,4 +2118,58 @@ expect failure errno -14 accept 180.2003062924 109.9750225424 expect failure errno -14 +------------------------------------------------------------------------------- +Test inverse +------------------------------------------------------------------------------- +operation +proj=adams_ws2 +ellps=WGS84 +------------------------------------------------------------------------------- +direction forward +tolerance 1 mm + +accept 0 0 +expect 0 0 +roundtrip 1 + +accept 40 60 +expect 2021909.611 4162291.966 +roundtrip 1 + +accept 179.999 0 +expect 16686159.356 0.000 +roundtrip 1 + +accept -179.999 0 +expect -16686159.356 0.000 +roundtrip 1 + +accept 0 89.999 +expect 0 15743336.122 +roundtrip 1 + +accept 0 -89.999 +expect 0 -15743336.122 +roundtrip 1 + +# Results a bit different on x86 +tolerance 3 mm +accept 179.999 89.999 +expect 693320.704 16030515.906 +roundtrip 1 + +accept 179.999 -89.999 +expect 693320.702 -16030515.904 +roundtrip 1 + +accept -179.999 89.999 +expect -693320.702 16030515.904 +roundtrip 1 + +accept -179.999 -89.999 +expect -693320.704 -16030515.906 +roundtrip 1 + +direction inverse +accept 0.000005801264 16722285.492330472916 +expect failure errno non_convergent + -- cgit v1.2.3