aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/iso19111/coordinateoperation.cpp45
-rwxr-xr-xtest/cli/testprojinfo4
-rw-r--r--test/cli/testprojinfo_out.dist5
3 files changed, 51 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;
}
}
diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo
index 3cb001d7..178d3076 100755
--- a/test/cli/testprojinfo
+++ b/test/cli/testprojinfo
@@ -135,6 +135,10 @@ echo "Testing -s "+proj=longlat +datum=WGS84 +geoidgrids=@foo.gtx +type=crs" -t
$EXE -s "+proj=longlat +datum=WGS84 +geoidgrids=@foo.gtx +type=crs" -t EPSG:4326 -o PROJ -q >>${OUT} 2>&1
echo "" >>${OUT}
+echo 'Testing -s "GDA94" -t "WGS 84 (G1762)" --spatial-test intersects --summary. Should include a transformation with Inverse of ITRF2008 to GDA94 (1) + Inverse of WGS 84 (G1762) to ITRF2008 (1)' >> ${OUT}
+$EXE -s "GDA94" -t "WGS 84 (G1762)" --spatial-test intersects --summary >>${OUT} 2>&1
+echo "" >>${OUT}
+
# do 'diff' with distribution results
echo "diff ${OUT} with testprojinfo_out.dist"
diff -u ${OUT} ${TEST_CLI_DIR}/testprojinfo_out.dist
diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist
index 2875626b..3a5ae187 100644
--- a/test/cli/testprojinfo_out.dist
+++ b/test/cli/testprojinfo_out.dist
@@ -1048,3 +1048,8 @@ INVERSE(EPSG):9225, Inverse of WGS 84 to ETRS89 (2), 0.1 m, Europe - offshore No
Testing -s +proj=longlat +datum=WGS84 +geoidgrids=@foo.gtx +type=crs -t EPSG:4326 -o PROJ -q
+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=vgridshift +grids=@foo.gtx +multiplier=1 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
+Testing -s "GDA94" -t "WGS 84 (G1762)" --spatial-test intersects --summary. Should include a transformation with Inverse of ITRF2008 to GDA94 (1) + Inverse of WGS 84 (G1762) to ITRF2008 (1)
+Candidate operations found: 2
+unknown id, GDA94 to WGS 84 (1) + WGS 84 to WGS 84 (G1762), 5 m, Australia - GDA
+unknown id, Conversion from GDA94 (geog2D) to GDA94 (geocentric) + Inverse of ITRF2008 to GDA94 (1) + Inverse of WGS 84 (G1762) to ITRF2008 (1) + Conversion from WGS 84 (G1762) (geocentric) to WGS 84 (G1762) (geog2D), 0.04 m, Australia - onshore and EEZ
+