diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-02-20 11:12:38 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-02-20 11:12:38 +0100 |
| commit | 3664cb546811146c588cab6db41b1ccef6fcee7a (patch) | |
| tree | 38a1077504b25b6cfcdf9ca11d07021c078988cf | |
| parent | b08b9580ab0aca70c8762b3f8f0039484ddaca60 (diff) | |
| download | PROJ-3664cb546811146c588cab6db41b1ccef6fcee7a.tar.gz PROJ-3664cb546811146c588cab6db41b1ccef6fcee7a.zip | |
compoundCRS to compoundCRS: avoid emitting dummy 'Null geographic offset from X to X' in transformation name
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 9 | ||||
| -rw-r--r-- | test/unit/gie_self_tests.cpp | 6 | ||||
| -rw-r--r-- | test/unit/test_operation.cpp | 26 |
3 files changed, 37 insertions, 4 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 90266307..ed98832f 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -10748,8 +10748,13 @@ static CoordinateOperationNNPtr createHorizVerticalHorizPROJBased( interpolationGeogCRS); bool dummy = false; - auto ops = std::vector<CoordinateOperationNNPtr>{ - opSrcCRSToGeogCRS, verticalTransform, opGeogCRStoDstCRS}; + auto ops = opSrcCRSToGeogCRS->sourceCRS()->_isEquivalentTo( + opSrcCRSToGeogCRS->targetCRS().get()) + ? std::vector<CoordinateOperationNNPtr>{verticalTransform, + opGeogCRStoDstCRS} + : std::vector<CoordinateOperationNNPtr>{opSrcCRSToGeogCRS, + verticalTransform, + opGeogCRStoDstCRS}; auto extent = getExtent(ops, true, dummy); auto properties = util::PropertyMap(); properties.set(common::IdentifiedObject::NAME_KEY, diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp index ad637786..3c5ffa86 100644 --- a/test/unit/gie_self_tests.cpp +++ b/test/unit/gie_self_tests.cpp @@ -421,9 +421,11 @@ TEST(gie, info_functions) { /* check a few key characteristics of the Mercator projection */ EXPECT_NEAR(factors.angular_distortion, 0.0, 1e-7) << factors.angular_distortion; /* angular distortion should be 0 */ + + /* Meridian/parallel angle should be 90 deg */ EXPECT_NEAR(factors.meridian_parallel_angle, M_PI_2, 1e-7) - << factors.meridian_parallel_angle; /* Meridian/parallel angle should be - 90 deg */ + << factors.meridian_parallel_angle; + EXPECT_EQ(factors.meridian_convergence, 0.0); /* meridian convergence should be 0 */ diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 58b740b6..9a968378 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -6125,6 +6125,32 @@ TEST(operation, compoundCRS_to_compoundCRS_with_vertical_transform) { // --------------------------------------------------------------------------- +TEST(operation, compoundCRS_to_compoundCRS_context) { + auto authFactory = + AuthorityFactory::create(DatabaseContext::create(), "EPSG"); + auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0); + ctxt->setSpatialCriterion( + CoordinateOperationContext::SpatialCriterion::PARTIAL_INTERSECTION); + auto list = CoordinateOperationFactory::create()->createOperations( + // NAD27 + NGVD29 height (ftUS) + authFactory->createCoordinateReferenceSystem("7406"), + // NAD83(NSRS2007) + NAVD88 height + authFactory->createCoordinateReferenceSystem("5500"), ctxt); + ASSERT_EQ(list.size(), 88U); + EXPECT_EQ(list[0]->nameStr(), "NGVD29 height (ftUS) to NAVD88 height (3) + " + "NAD27 to WGS 84 (79) + Inverse of " + "NAD83(NSRS2007) to WGS 84 (1)"); + EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=pipeline +step +proj=axisswap +order=2,1 +step " + "+proj=unitconvert +xy_in=deg +z_in=us-ft +xy_out=rad +z_out=m " + "+step +proj=vgridshift +grids=vertcone.gtx +multiplier=0.001 " + "+step +proj=hgridshift +grids=conus +step +proj=push +v_3 +step " + "+proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap " + "+order=2,1 +step +proj=pop +v_3"); +} + +// --------------------------------------------------------------------------- + TEST(operation, vertCRS_to_vertCRS) { auto vertcrs_m_obj = PROJStringParser().createFromPROJString("+vunits=m"); |
