aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/coordinateoperation.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-05-14 19:08:41 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-05-14 20:21:13 +0200
commit056226ee668f027e22baf6897da7507bcc98e132 (patch)
tree21ae98b05062bb49e22ffcf976c0985e48b666e9 /src/iso19111/coordinateoperation.cpp
parent587187645099ca7aeba1a890a69abc52dc2c3155 (diff)
downloadPROJ-056226ee668f027e22baf6897da7507bcc98e132.tar.gz
PROJ-056226ee668f027e22baf6897da7507bcc98e132.zip
createOperations(): optimize BoundCRS to BoundCRS of vertical CRS using the same vertical datum
Diffstat (limited to 'src/iso19111/coordinateoperation.cpp')
-rw-r--r--src/iso19111/coordinateoperation.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 8303819f..3ffd208f 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -13212,7 +13212,7 @@ CoordinateOperationFactory::Private::createOperations(
return applyInverse(createOperations(targetCRS, sourceCRS, context));
}
- // boundCRS to boundCRS using the same geographic hubCRS
+ // boundCRS to boundCRS
if (boundSrc && boundDst) {
createOperationsBoundToBound(sourceCRS, targetCRS, context, boundSrc,
boundDst, res);
@@ -14348,6 +14348,7 @@ void CoordinateOperationFactory::Private::createOperationsBoundToBound(
ENTER_FUNCTION();
+ // BoundCRS to BoundCRS of horizontal CRS using the same (geographic) hub
const auto &hubSrc = boundSrc->hubCRS();
auto hubSrcGeog = dynamic_cast<const crs::GeographicCRS *>(hubSrc.get());
const auto &hubDst = boundDst->hubCRS();
@@ -14396,6 +14397,28 @@ void CoordinateOperationFactory::Private::createOperationsBoundToBound(
}
}
+ // BoundCRS to BoundCRS of vertical CRS using the same vertical datum
+ // ==> ignore the bound transformation
+ auto baseOfBoundSrcAsVertCRS =
+ dynamic_cast<crs::VerticalCRS *>(boundSrc->baseCRS().get());
+ auto baseOfBoundDstAsVertCRS =
+ dynamic_cast<crs::VerticalCRS *>(boundDst->baseCRS().get());
+ if (baseOfBoundSrcAsVertCRS && baseOfBoundDstAsVertCRS) {
+ const auto datumSrc = baseOfBoundSrcAsVertCRS->datum();
+ const auto datumDst = baseOfBoundDstAsVertCRS->datum();
+ if (datumSrc && datumDst &&
+ datumSrc->nameStr() == datumDst->nameStr() &&
+ (datumSrc->nameStr() != "unknown" ||
+ boundSrc->transformation()->_isEquivalentTo(
+ boundDst->transformation().get(),
+ util::IComparable::Criterion::EQUIVALENT))) {
+ res = createOperations(boundSrc->baseCRS(), boundDst->baseCRS(),
+ context);
+ return;
+ }
+ }
+
+ // BoundCRS to BoundCRS of vertical CRS
auto vertCRSOfBaseOfBoundSrc = boundSrc->baseCRS()->extractVerticalCRS();
auto vertCRSOfBaseOfBoundDst = boundDst->baseCRS()->extractVerticalCRS();
if (hubSrcGeog && hubDstGeog &&