From d6f6862352d0caeb827c0c3ec98ccf9aa2f9a1d2 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 24 Nov 2020 16:41:06 +0100 Subject: createOperation(): add a ballpark vertical transformation when dealing with GEOIDMODEL[] --- test/cli/testprojinfo_out.dist | 69 ++++++++++++++++++++++++++++++++++++++++-- test/unit/test_c_api.cpp | 49 ++++++++++++++++++++++-------- test/unit/test_operation.cpp | 12 ++++---- 3 files changed, 109 insertions(+), 21 deletions(-) (limited to 'test') diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index 174f11d3..8e8ef294 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -990,7 +990,7 @@ PROJ.4 string: +proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs Testing RH2000 height to SWEREF99: projinfo -s EPSG:5613 -t EPSG:4977 -Candidate operations found: 1 +Candidate operations found: 2 ------------------------------------- Operation No. 1: @@ -1042,8 +1042,55 @@ COORDINATEOPERATION["Inverse of SWEREF99 to RH2000 height", BBOX[55.28,10.93,69.07,24.17]], ID["INVERSE(DERIVED_FROM(PROJ))","EPSG_4977_TO_EPSG_5613"]] +------------------------------------- +Operation No. 2: + +unknown id, Transformation from RH2000 height to SWEREF99 (ballpark vertical transformation, without ellipsoid height to vertical height correction), unknown accuracy, World, has ballpark transformation + +PROJ string: ++proj=noop + +WKT2:2019 string: +COORDINATEOPERATION["Transformation from RH2000 height to SWEREF99 (ballpark vertical transformation, without ellipsoid height to vertical height correction)", + SOURCECRS[ + VERTCRS["RH2000 height", + DYNAMIC[ + FRAMEEPOCH[2000]], + VDATUM["Rikets hojdsystem 2000"], + CS[vertical,1], + AXIS["gravity-related height (H)",up, + LENGTHUNIT["metre",1]], + ID["EPSG",5613]]], + TARGETCRS[ + GEOGCRS["SWEREF99", + DATUM["SWEREF99", + ELLIPSOID["GRS 1980",6378137,298.257222101, + LENGTHUNIT["metre",1]]], + PRIMEM["Greenwich",0, + ANGLEUNIT["degree",0.0174532925199433]], + CS[ellipsoidal,3], + AXIS["geodetic latitude (Lat)",north, + ORDER[1], + ANGLEUNIT["degree",0.0174532925199433]], + AXIS["geodetic longitude (Lon)",east, + ORDER[2], + ANGLEUNIT["degree",0.0174532925199433]], + AXIS["ellipsoidal height (h)",up, + ORDER[3], + LENGTHUNIT["metre",1]], + ID["EPSG",4977]]], + METHOD["Change of Vertical Unit", + ID["EPSG",1069]], + PARAMETER["Unit conversion scalar",1, + SCALEUNIT["unity",1], + ID["EPSG",1051]], + USAGE[ + SCOPE["unknown"], + AREA["World"], + BBOX[-90,-180,90,180]]] + Testing NAD83(2011) + NAVD88 height -> NAD83(2011) : projinfo -s EPSG:6349 -t EPSG:6319 --spatial-test intersects -o PROJ -Candidate operations found: 2 +Candidate operations found: 3 ------------------------------------- Operation No. 1: @@ -1070,8 +1117,16 @@ PROJ string: +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1 +------------------------------------- +Operation No. 3: + +unknown id, Transformation from NAVD88 height to NAD83(2011) (ballpark vertical transformation, without ellipsoid height to vertical height correction), unknown accuracy, World, has ballpark transformation + +PROJ string: ++proj=noop + Testing NGF IGN69 height to RGF93: projinfo -s EPSG:5720 -t EPSG:4965 -o PROJ -Candidate operations found: 1 +Candidate operations found: 2 ------------------------------------- Operation No. 1: @@ -1085,6 +1140,14 @@ PROJ string: +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1 +------------------------------------- +Operation No. 2: + +unknown id, Transformation from NGF-IGN69 height to RGF93 (ballpark vertical transformation, without ellipsoid height to vertical height correction), unknown accuracy, World, has ballpark transformation + +PROJ string: ++proj=noop + Testing EPSG:32631 --3d PROJ.4 string: +proj=utm +zone=31 +datum=WGS84 +units=m +no_defs +type=crs diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index a7c1eb53..9885d221 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -4650,10 +4650,21 @@ TEST_F(CApi, proj_create_vertical_crs_ex) { ObjectKeeper keeper_geog_crs(geog_crs); ASSERT_NE(geog_crs, nullptr); - auto P = proj_create_crs_to_crs_from_pj(m_ctxt, compound, geog_crs, nullptr, - nullptr); - ObjectKeeper keeper_P(P); - ASSERT_NE(P, nullptr); + PJ_OPERATION_FACTORY_CONTEXT *ctxt = + proj_create_operation_factory_context(m_ctxt, nullptr); + ASSERT_NE(ctxt, nullptr); + ContextKeeper keeper_ctxt(ctxt); + proj_operation_factory_context_set_grid_availability_use( + m_ctxt, ctxt, PROJ_GRID_AVAILABILITY_IGNORED); + proj_operation_factory_context_set_spatial_criterion( + m_ctxt, ctxt, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION); + PJ_OBJ_LIST *operations = + proj_create_operations(m_ctxt, compound, geog_crs, ctxt); + ASSERT_NE(operations, nullptr); + ObjListKeeper keeper_operations(operations); + EXPECT_GE(proj_list_get_count(operations), 1); + auto P = proj_list_get(m_ctxt, operations, 0); + ObjectKeeper keeper_transform(P); auto name = proj_get_name(P); ASSERT_TRUE(name != nullptr); @@ -4706,10 +4717,21 @@ TEST_F(CApi, proj_create_vertical_crs_ex_with_geog_crs) { ObjectKeeper keeper_geog_crs(geog_crs); ASSERT_NE(geog_crs, nullptr); - auto P = proj_create_crs_to_crs_from_pj(m_ctxt, compound, geog_crs, nullptr, - nullptr); - ObjectKeeper keeper_P(P); - ASSERT_NE(P, nullptr); + PJ_OPERATION_FACTORY_CONTEXT *ctxt = + proj_create_operation_factory_context(m_ctxt, nullptr); + ASSERT_NE(ctxt, nullptr); + ContextKeeper keeper_ctxt(ctxt); + proj_operation_factory_context_set_grid_availability_use( + m_ctxt, ctxt, PROJ_GRID_AVAILABILITY_IGNORED); + proj_operation_factory_context_set_spatial_criterion( + m_ctxt, ctxt, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION); + PJ_OBJ_LIST *operations = + proj_create_operations(m_ctxt, compound, geog_crs, ctxt); + ASSERT_NE(operations, nullptr); + ObjListKeeper keeper_operations(operations); + EXPECT_GE(proj_list_get_count(operations), 1); + auto P = proj_list_get(m_ctxt, operations, 0); + ObjectKeeper keeper_transform(P); auto name = proj_get_name(P); ASSERT_TRUE(name != nullptr); @@ -4739,10 +4761,13 @@ TEST_F(CApi, proj_create_vertical_crs_ex_with_geog_crs) { ObjectKeeper keeper_compound_from_projjson(compound_from_projjson); ASSERT_NE(compound_from_projjson, nullptr); - auto P2 = proj_create_crs_to_crs_from_pj(m_ctxt, compound_from_projjson, - geog_crs, nullptr, nullptr); - ObjectKeeper keeper_P2(P2); - ASSERT_NE(P2, nullptr); + PJ_OBJ_LIST *operations2 = + proj_create_operations(m_ctxt, compound_from_projjson, geog_crs, ctxt); + ASSERT_NE(operations2, nullptr); + ObjListKeeper keeper_operations2(operations2); + EXPECT_GE(proj_list_get_count(operations2), 1); + auto P2 = proj_list_get(m_ctxt, operations2, 0); + ObjectKeeper keeper_transform2(P2); auto name_bis = proj_get_name(P2); ASSERT_TRUE(name_bis != nullptr); diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index b6e555b1..9bf883d9 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -4867,7 +4867,7 @@ TEST(operation, vertCRS_to_geogCRS_context) { "3855"), // EGM2008 height authFactory->createCoordinateReferenceSystem("4979"), // WGS 84 ctxt); - ASSERT_EQ(list.size(), 2U); + ASSERT_EQ(list.size(), 3U); EXPECT_EQ( list[1]->exportToPROJString( PROJStringFormatter::create( @@ -4889,7 +4889,7 @@ TEST(operation, vertCRS_to_geogCRS_context) { "3855"), // EGM2008 height authFactory->createCoordinateReferenceSystem("4979"), // WGS 84 ctxt); - ASSERT_EQ(list.size(), 2U); + ASSERT_EQ(list.size(), 3U); EXPECT_EQ( list[0]->exportToPROJString(PROJStringFormatter::create().get()), "+proj=pipeline " @@ -4938,7 +4938,7 @@ TEST(operation, vertCRS_to_geogCRS_context) { authFactory->createCoordinateReferenceSystem("7839"), // NZGD2000 authFactory->createCoordinateReferenceSystem("4959"), ctxt); - ASSERT_EQ(list.size(), 1U); + ASSERT_EQ(list.size(), 2U); EXPECT_EQ( list[0]->exportToPROJString(PROJStringFormatter::create().get()), "+proj=pipeline " @@ -4964,7 +4964,7 @@ TEST(operation, vertCRS_to_geogCRS_context) { authFactory->createCoordinateReferenceSystem("8357"), // ETRS89 authFactory->createCoordinateReferenceSystem("4937"), ctxt); - ASSERT_EQ(list.size(), 1U); + ASSERT_EQ(list.size(), 2U); EXPECT_EQ( list[0]->exportToPROJString(PROJStringFormatter::create().get()), "+proj=pipeline " @@ -8912,7 +8912,7 @@ TEST(operation, compoundCRS_to_geogCRS_2D_promote_to_3D_context) { ctxt); // The checked value is not that important, but in case this changes, // likely due to a EPSG upgrade, worth checking - EXPECT_EQ(listCompoundToGeog2D.size(), 141U); + EXPECT_EQ(listCompoundToGeog2D.size(), 142U); auto listGeog2DToCompound = CoordinateOperationFactory::create()->createOperations(dst, nnSrc, @@ -11169,7 +11169,7 @@ TEST(operation, normalizeForVisualization) { src, authFactory->createCoordinateReferenceSystem("4979"), // WGS 84 3D ctxt); - ASSERT_EQ(list.size(), 2U); + ASSERT_EQ(list.size(), 3U); auto op = list[1]; auto opNormalized = op->normalizeForVisualization(); EXPECT_FALSE(opNormalized->_isEquivalentTo(op.get())); -- cgit v1.2.3