Skip to content

Commit

Permalink
grid_alternatives.sql: add the two Swisstopo grids (refs OSGeo/proj-d…
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jun 25, 2019
1 parent 6800530 commit 7a131de
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 7 deletions.
32 changes: 32 additions & 0 deletions data/sql/grid_alternatives.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
31 changes: 24 additions & 7 deletions test/unit/test_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

// ---------------------------------------------------------------------------
Expand Down

0 comments on commit 7a131de

Please sign in to comment.