aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_operationfactory.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-12-09 18:17:45 +0100
committerGitHub <noreply@github.com>2021-12-09 18:17:45 +0100
commit587d80536d1cabc70edeb19dbedf46974370b5eb (patch)
tree974bc80ee3ef60fdc33b0deb87c4c56b5e5df324 /test/unit/test_operationfactory.cpp
parent90997086e19251190d367d60e329288324a727a1 (diff)
parentc9fe5a1a06c7becf257b23842cc13e89416489b0 (diff)
downloadPROJ-587d80536d1cabc70edeb19dbedf46974370b5eb.tar.gz
PROJ-587d80536d1cabc70edeb19dbedf46974370b5eb.zip
Merge pull request #2977 from OSGeo/backport-2976-to-8.2
[Backport 8.2] createOperations(): improvement for "NAD83(CSRS) + CGVD28 height" to "NAD83(CSRS) + CGVD2013(CGG2013) height"
Diffstat (limited to 'test/unit/test_operationfactory.cpp')
-rw-r--r--test/unit/test_operationfactory.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp
index a445d8c7..e387b7ab 100644
--- a/test/unit/test_operationfactory.cpp
+++ b/test/unit/test_operationfactory.cpp
@@ -4518,6 +4518,63 @@ TEST(operation, compoundCRS_to_compoundCRS_issue_2720) {
// ---------------------------------------------------------------------------
+TEST(
+ operation,
+ compoundCRS_to_compoundCRS_concatenated_operation_with_two_vert_transformation_and_ballpark_geog) {
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ // "NAD83(CSRS) + CGVD28 height"
+ auto srcObj = createFromUserInput("EPSG:4617+5713",
+ authFactory->databaseContext(), false);
+ auto src = nn_dynamic_pointer_cast<CRS>(srcObj);
+ ASSERT_TRUE(src != nullptr);
+
+ // "NAD83(CSRS) + CGVD2013(CGG2013) height"
+ auto dstObj = createFromUserInput("EPSG:4617+6647",
+ authFactory->databaseContext(), false);
+ auto dst = nn_dynamic_pointer_cast<CRS>(dstObj);
+ ASSERT_TRUE(dst != nullptr);
+
+ // That transformation involves doing CGVD28 height to CGVD2013(CGG2013)
+ // height by doing:
+ // - CGVD28 height to NAD83(CSRS): EPSG registered operation
+ // - NAD83(CSRS) to CGVD2013(CGG2013) height by doing:
+ // * NAD83(CSRS) to NAD83(CSRS)v6: ballpark
+ // * NAD83(CSRS)v6 to CGVD2013(CGG2013): EPSG registered operation
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
+ ctxt->setSpatialCriterion(
+ CoordinateOperationContext::SpatialCriterion::PARTIAL_INTERSECTION);
+ {
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ NN_NO_CHECK(src), NN_NO_CHECK(dst), ctxt);
+ ASSERT_GE(list.size(), 1U);
+ // Check that we have the transformation using NAD83(CSRS)v6 first
+ // (as well as the one between NAD83(CSRS) to CGVD28 height)
+ EXPECT_EQ(list[0]->nameStr(),
+ "Inverse of NAD83(CSRS) to CGVD28 height (1) + "
+ "Inverse of Ballpark geographic offset from NAD83(CSRS)v6 to "
+ "NAD83(CSRS) + "
+ "NAD83(CSRS)v6 to CGVD2013(CGG2013) height (1) + "
+ "Inverse of Ballpark geographic offset from NAD83(CSRS) to "
+ "NAD83(CSRS)v6");
+ }
+ {
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ NN_NO_CHECK(dst), NN_NO_CHECK(src), ctxt);
+ ASSERT_GE(list.size(), 1U);
+ // Check that we have the transformation using NAD83(CSRS)v6 first
+ // (as well as the one between NAD83(CSRS) to CGVD28 height)
+ EXPECT_EQ(
+ list[0]->nameStr(),
+ "Ballpark geographic offset from NAD83(CSRS) to NAD83(CSRS)v6 + "
+ "Inverse of NAD83(CSRS)v6 to CGVD2013(CGG2013) height (1) + "
+ "Ballpark geographic offset from NAD83(CSRS)v6 to NAD83(CSRS) + "
+ "NAD83(CSRS) to CGVD28 height (1)");
+ }
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, vertCRS_to_vertCRS) {
auto vertcrs_m_obj = PROJStringParser().createFromPROJString("+vunits=m");