diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-11-11 19:07:26 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-11-11 22:29:10 +0100 |
| commit | 86a197a7d6ef953810ad5c7e0c675e3cefc16dbe (patch) | |
| tree | 825fcf65719840a5f4a5a651e4421987ca03c813 /test/unit/test_operationfactory.cpp | |
| parent | f7e9db583b709b62aabeaf8ae7f8b1f7e1505395 (diff) | |
| download | PROJ-86a197a7d6ef953810ad5c7e0c675e3cefc16dbe.tar.gz PROJ-86a197a7d6ef953810ad5c7e0c675e3cefc16dbe.zip | |
createOperations(): do not stop at the first operation in the PROJ namespace for vertical transformations
In particular helps with transformation between "NAD83 + NAVD88 height" and WGS 84 that
have regressed in 8.2.0
Fixes #2936
Diffstat (limited to 'test/unit/test_operationfactory.cpp')
| -rw-r--r-- | test/unit/test_operationfactory.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp index 2246c60c..a445d8c7 100644 --- a/test/unit/test_operationfactory.cpp +++ b/test/unit/test_operationfactory.cpp @@ -4922,6 +4922,53 @@ TEST(operation, compoundCRS_to_geogCRS_3D_context) { "+step +proj=unitconvert +xy_in=rad +xy_out=deg " "+step +proj=axisswap +order=2,1"); } + + // Check that we can handle vertical transformations where there is a + // mix of available ones in the PROJ namespace (mx_inegi_ggm10) and in + // in the EPSG namespace (us_noaa_g2018u0) + // This test might no longer test this scenario if mx_inegi_ggm10 is + // referenced one day by EPSG, but at least this tests a common use case. + { + auto authFactoryAll = + AuthorityFactory::create(DatabaseContext::create(), std::string()); + auto ctxt = + CoordinateOperationContext::create(authFactoryAll, nullptr, 0.0); + ctxt->setSpatialCriterion( + CoordinateOperationContext::SpatialCriterion::PARTIAL_INTERSECTION); + ctxt->setGridAvailabilityUse( + CoordinateOperationContext::GridAvailabilityUse:: + IGNORE_GRID_AVAILABILITY); + // NAD83(2011) + NAVD88 height + auto srcObj = createFromUserInput( + "EPSG:6318+5703", authFactory->databaseContext(), false); + auto src = nn_dynamic_pointer_cast<CRS>(srcObj); + ASSERT_TRUE(src != nullptr); + auto nnSrc = NN_NO_CHECK(src); + + auto list = CoordinateOperationFactory::create()->createOperations( + nnSrc, + authFactory->createCoordinateReferenceSystem("4979"), // WGS 84 3D + ctxt); + bool foundGeoid2018 = false; + bool foundGGM10 = false; + for (const auto &op : list) { + try { + const auto projString = op->exportToPROJString( + PROJStringFormatter::create( + PROJStringFormatter::Convention::PROJ_5, + authFactory->databaseContext()) + .get()); + if (projString.find("us_noaa_g2018u0.tif") != std::string::npos) + foundGeoid2018 = true; + else if (projString.find("mx_inegi_ggm10.tif") != + std::string::npos) + foundGGM10 = true; + } catch (const std::exception &) { + } + } + EXPECT_TRUE(foundGeoid2018); + EXPECT_TRUE(foundGGM10); + } } // --------------------------------------------------------------------------- |
