diff options
| -rw-r--r-- | data/sql/grid_alternatives.sql | 32 | ||||
| -rw-r--r-- | test/unit/test_operation.cpp | 31 |
2 files changed, 56 insertions, 7 deletions
diff --git a/data/sql/grid_alternatives.sql b/data/sql/grid_alternatives.sql index cf1e559d..17701d30 100644 --- a/data/sql/grid_alternatives.sql +++ b/data/sql/grid_alternatives.sql @@ -853,3 +853,35 @@ INSERT INTO grid_alternatives(original_grid_name, 0, 'proj-datumgrid-europe', NULL, NULL, NULL, NULL); + +-- Switzerland + +INSERT INTO grid_alternatives(original_grid_name, + proj_grid_name, + proj_grid_format, + proj_method, + inverse_direction, + package_name, + url, direct_download, open_license, directory) + VALUES ('CHENyx06a.gsb', + 'CHENyx06a.gsb', + 'NTv2', + 'hgridshift', + 0, + 'proj-datumgrid-europe', + NULL, NULL, NULL, NULL); + +INSERT INTO grid_alternatives(original_grid_name, + proj_grid_name, + proj_grid_format, + proj_method, + inverse_direction, + package_name, + url, direct_download, open_license, directory) + VALUES ('CHENyx06_ETRS.gsb', + 'CHENyx06_ETRS.gsb', + 'NTv2', + 'hgridshift', + 0, + 'proj-datumgrid-europe', + NULL, NULL, NULL, NULL); diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 64112a82..1a9b69d5 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -4655,24 +4655,41 @@ TEST(operation, geogCRS_to_geogCRS_CH1903_to_CH1903plus_context) { auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0); ctxt->setAllowUseIntermediateCRS( CoordinateOperationContext::IntermediateCRSUse::ALWAYS); + ctxt->setGridAvailabilityUse( + CoordinateOperationContext::GridAvailabilityUse:: + IGNORE_GRID_AVAILABILITY); auto list = CoordinateOperationFactory::create()->createOperations( authFactory->createCoordinateReferenceSystem("4149"), // CH1903 authFactory->createCoordinateReferenceSystem("4150"), // CH1903+ ctxt); - ASSERT_EQ(list.size(), 2U); + ASSERT_TRUE(list.size() == 2U || list.size() == 3U); - EXPECT_EQ(list[0]->nameStr(), - "CH1903 to ETRS89 (1) + Inverse of CH1903+ to ETRS89 (1)"); + EXPECT_EQ(list[0]->nameStr(), "CH1903 to CH1903+ (1)"); EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()), - "+proj=noop"); - - EXPECT_EQ(list[1]->nameStr(), "CH1903 to CH1903+ (1)"); - EXPECT_EQ(list[1]->exportToPROJString(PROJStringFormatter::create().get()), "+proj=pipeline +step +proj=axisswap +order=2,1 " "+step +proj=unitconvert +xy_in=deg +xy_out=rad " "+step +proj=hgridshift +grids=CHENyx06a.gsb " "+step +proj=unitconvert +xy_in=rad +xy_out=deg " "+step +proj=axisswap +order=2,1"); + + if (list.size() == 2U) { + // Grids not there + EXPECT_EQ(list[1]->nameStr(), + "CH1903 to ETRS89 (1) + Inverse of CH1903+ to ETRS89 (1)"); + EXPECT_EQ( + list[1]->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=noop"); + } else { + // Grids available + EXPECT_EQ(list[1]->nameStr(), + "CH1903 to ETRS89 (2) + Inverse of CH1903+ to ETRS89 (1)"); + + EXPECT_EQ(list[2]->nameStr(), + "CH1903 to ETRS89 (1) + Inverse of CH1903+ to ETRS89 (1)"); + EXPECT_EQ( + list[2]->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=noop"); + } } // --------------------------------------------------------------------------- |
