aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_operationfactory.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2022-03-19 18:10:53 +0100
committerGitHub <noreply@github.com>2022-03-19 18:10:53 +0100
commit5d3b2a94c61f4c8ad98173480b90b739dab2f5c9 (patch)
tree02148163323caf53be579c0d74e17666dae06d9f /test/unit/test_operationfactory.cpp
parent0dbff99390d1a027d89d89762af23121224a9415 (diff)
parent940186f7afce353befd67cb8303999c8fce66f5c (diff)
downloadPROJ-9.0.tar.gz
PROJ-9.0.zip
Merge pull request #3124 from OSGeo/backport-3123-to-9.09.0
[Backport 9.0] createOperations(): fix transformation involving CompoundCRS, ToWGS84 and PROJ4_GRIDS
Diffstat (limited to 'test/unit/test_operationfactory.cpp')
-rw-r--r--test/unit/test_operationfactory.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp
index 0c3ecae4..3476aa9a 100644
--- a/test/unit/test_operationfactory.cpp
+++ b/test/unit/test_operationfactory.cpp
@@ -5970,6 +5970,61 @@ TEST(operation, compoundCRS_of_vertCRS_with_geoid_model_to_geogCRS) {
// ---------------------------------------------------------------------------
+TEST(operation,
+ compoundCRS_of_horizCRS_with_TOWGS84_vertCRS_with_geoid_model_to_geogCRS) {
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
+ ctxt->setSpatialCriterion(
+ CoordinateOperationContext::SpatialCriterion::PARTIAL_INTERSECTION);
+ ctxt->setGridAvailabilityUse(
+ CoordinateOperationContext::GridAvailabilityUse::
+ IGNORE_GRID_AVAILABILITY);
+ auto wkt = "COMPD_CS[\"NAD83(CSRS) + CGVD28 height - HT2_0\",\n"
+ " GEOGCS[\"NAD83(CSRS)\",\n"
+ " DATUM[\"NAD83_Canadian_Spatial_Reference_System\",\n"
+ " SPHEROID[\"GRS 1980\",6378137,298.257222101,\n"
+ " AUTHORITY[\"EPSG\",\"7019\"]],\n"
+ " TOWGS84[0,0,0,0,0,0,0],\n"
+ " AUTHORITY[\"EPSG\",\"6140\"]],\n"
+ " PRIMEM[\"Greenwich\",0,\n"
+ " AUTHORITY[\"EPSG\",\"8901\"]],\n"
+ " UNIT[\"degree\",0.0174532925199433,\n"
+ " AUTHORITY[\"EPSG\",\"9122\"]],\n"
+ " AUTHORITY[\"EPSG\",\"4617\"]],\n"
+ " VERT_CS[\"CGVD28 height - HT2_0\",\n"
+ " VERT_DATUM[\"Canadian Geodetic Vertical Datum of "
+ "1928\",2005,\n"
+ " EXTENSION[\"PROJ4_GRIDS\",\"HT2_0.gtx\"],\n"
+ " AUTHORITY[\"EPSG\",\"5114\"]],\n"
+ " UNIT[\"metre\",1,\n"
+ " AUTHORITY[\"EPSG\",\"9001\"]],\n"
+ " AXIS[\"Gravity-related height\",UP],\n"
+ " AUTHORITY[\"EPSG\",\"5713\"]]]";
+ auto srcObj =
+ createFromUserInput(wkt, authFactory->databaseContext(), false);
+ auto src = nn_dynamic_pointer_cast<CRS>(srcObj);
+ ASSERT_TRUE(src != nullptr);
+ // NAD83(CSRS) 3D
+ auto dst = authFactory->createCoordinateReferenceSystem("4955");
+
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ NN_NO_CHECK(src), dst, ctxt);
+ ASSERT_EQ(list.size(), 1U);
+ auto op_proj =
+ list[0]->exportToPROJString(PROJStringFormatter::create().get());
+ EXPECT_EQ(op_proj, "+proj=pipeline "
+ "+step +proj=push +v_1 +v_2 "
+ "+step +proj=axisswap +order=2,1 "
+ "+step +proj=unitconvert +xy_in=deg +xy_out=rad "
+ "+step +proj=vgridshift +grids=HT2_0.gtx +multiplier=1 "
+ "+step +proj=unitconvert +xy_in=rad +xy_out=deg "
+ "+step +proj=axisswap +order=2,1 "
+ "+step +proj=pop +v_1 +v_2");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, compoundCRS_from_WKT2_to_geogCRS_3D_context) {
auto authFactory =
AuthorityFactory::create(DatabaseContext::create(), "EPSG");