diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-11-18 21:11:27 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-11-18 21:11:27 +0100 |
| commit | 0d7e238deaaca4c55cde63408d9985496d99c68f (patch) | |
| tree | 9e2eba1b93933c4ac034766b79ef292bc37a6373 /src | |
| parent | 2b9b65d0ffbe685fc33857df0f48a387d4611483 (diff) | |
| download | PROJ-0d7e238deaaca4c55cde63408d9985496d99c68f.tar.gz PROJ-0d7e238deaaca4c55cde63408d9985496d99c68f.zip | |
createOperations(): fix so that GDA94 -> WGS 84 (G1762) still include a result through ITRF2008. Was broken in master by the addition of the 'WGS84 -> WGS 84 (Gxxx)' null operations in the PROJ authority
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 92bfa2ba..8dd761ea 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -12268,6 +12268,37 @@ void CoordinateOperationFactory::Private::setCRSs( // --------------------------------------------------------------------------- +static bool hasResultSetOnlyResultsWithPROJStep( + const std::vector<CoordinateOperationNNPtr> &res) { + for (const auto &op : res) { + auto concat = dynamic_cast<const ConcatenatedOperation *>(op.get()); + if (concat) { + bool hasPROJStep = false; + const auto &steps = concat->operations(); + for (const auto &step : steps) { + const auto &ids = step->identifiers(); + if (!ids.empty()) { + const auto &opAuthority = *(ids.front()->codeSpace()); + if (opAuthority == "PROJ" || + opAuthority == "INVERSE(PROJ)" || + opAuthority == "DERIVED_FROM(PROJ)") { + hasPROJStep = true; + break; + } + } + } + if (!hasPROJStep) { + return false; + } + } else { + return false; + } + } + return true; +} + +// --------------------------------------------------------------------------- + void CoordinateOperationFactory::Private::createOperationsWithDatumPivot( std::vector<CoordinateOperationNNPtr> &res, const crs::CRSNNPtr &sourceCRS, const crs::CRSNNPtr &targetCRS, const crs::GeodeticCRS *geodSrc, @@ -12416,16 +12447,19 @@ void CoordinateOperationFactory::Private::createOperationsWithDatumPivot( createTransformations(candidateSrcGeod, candidateDstGeod, opsFirst[0], isNullFirst); if (!res.empty()) { + if (hasResultSetOnlyResultsWithPROJStep(res)) { + continue; + } return; } - break; } } - break; } } for (const auto &candidateSrcGeod : candidatesSrcGeod) { + const bool bSameSrcName = + candidateSrcGeod->nameStr() == sourceCRS->nameStr(); #ifdef TRACE_CREATE_OPERATIONS ENTER_BLOCK(""); #endif @@ -12435,6 +12469,11 @@ void CoordinateOperationFactory::Private::createOperationsWithDatumPivot( const bool isNullFirst = isNullTransformation(opsFirst[0]->nameStr()); for (const auto &candidateDstGeod : candidatesDstGeod) { + if (bSameSrcName && + candidateDstGeod->nameStr() == targetCRS->nameStr()) { + continue; + } + #ifdef TRACE_CREATE_OPERATIONS ENTER_BLOCK("try " + objectAsStr(sourceCRS.get()) + "->" + objectAsStr(candidateSrcGeod.get()) + "->" + @@ -12443,7 +12482,7 @@ void CoordinateOperationFactory::Private::createOperationsWithDatumPivot( #endif createTransformations(candidateSrcGeod, candidateDstGeod, opsFirst[0], isNullFirst); - if (!res.empty()) { + if (!res.empty() && hasResultSetOnlyResultsWithPROJStep(res)) { return; } } |
