aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-09-12 22:31:07 +0200
committerEven Rouault <even.rouault@spatialys.com>2019-09-12 22:57:25 +0200
commite6eae43cf2310c77a466fee257d9974b14ee85fd (patch)
tree8c3c8714a45f4c9820fe6cf2e9f756c45f0c69cf /src
parenteed28e5183579d09e102d1ad72e91fc82005dfe8 (diff)
downloadPROJ-e6eae43cf2310c77a466fee257d9974b14ee85fd.tar.gz
PROJ-e6eae43cf2310c77a466fee257d9974b14ee85fd.zip
createOperations(): when tranforming from a compoundCRS whose vertical component is a BoundCRS, do not apply the horizontal transformation twice
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/coordinateoperation.cpp58
1 files changed, 40 insertions, 18 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index aad86410..aea8400c 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -10173,6 +10173,7 @@ struct CoordinateOperationFactory::Private {
bool inCreateOperationsWithDatumPivotAntiRecursion = false;
bool inCreateOperationsThroughPreferredHub = false;
bool inCreateOperationsGeogToVertWithIntermediate = false;
+ bool skipHorizontalTransformation = false;
Context(const crs::CRSNNPtr &sourceCRSIn,
const crs::CRSNNPtr &targetCRSIn,
@@ -12784,27 +12785,32 @@ CoordinateOperationFactory::Private::createOperations(
hubSrcGeog->coordinateSystem()->axisList().size() == 3 &&
geogDst->coordinateSystem()->axisList().size() == 3) {
auto opsFirst = createOperations(sourceCRS, hubSrc, context);
- auto opsSecond = createOperations(hubSrc, targetCRS, context);
- if (!opsFirst.empty() && !opsSecond.empty()) {
- for (const auto &opFirst : opsFirst) {
- for (const auto &opLast : opsSecond) {
- // Exclude artificial transformations from the hub
- // to the target CRS
- if (!opLast->hasBallparkTransformation()) {
- try {
- res.emplace_back(
- ConcatenatedOperation::
- createComputeMetadata(
- {opFirst, opLast},
- !allowEmptyIntersection));
- } catch (
- const InvalidOperationEmptyIntersection &) {
+ if (context.skipHorizontalTransformation) {
+ if (!opsFirst.empty())
+ return opsFirst;
+ } else {
+ auto opsSecond = createOperations(hubSrc, targetCRS, context);
+ if (!opsFirst.empty() && !opsSecond.empty()) {
+ for (const auto &opFirst : opsFirst) {
+ for (const auto &opLast : opsSecond) {
+ // Exclude artificial transformations from the hub
+ // to the target CRS
+ if (!opLast->hasBallparkTransformation()) {
+ try {
+ res.emplace_back(
+ ConcatenatedOperation::
+ createComputeMetadata(
+ {opFirst, opLast},
+ !allowEmptyIntersection));
+ } catch (
+ const InvalidOperationEmptyIntersection &) {
+ }
}
}
}
- }
- if (!res.empty()) {
- return res;
+ if (!res.empty()) {
+ return res;
+ }
}
}
}
@@ -13026,6 +13032,22 @@ CoordinateOperationFactory::Private::createOperations(
std::vector<CoordinateOperationNNPtr> verticalTransforms;
if (componentsSrc.size() >= 2 &&
componentsSrc[1]->extractVerticalCRS()) {
+
+ struct SetSkipHorizontalTransform {
+ Context &context;
+
+ explicit SetSkipHorizontalTransform(Context &contextIn)
+ : context(contextIn) {
+ assert(!context.skipHorizontalTransformation);
+ context.skipHorizontalTransformation = true;
+ }
+
+ ~SetSkipHorizontalTransform() {
+ context.skipHorizontalTransformation = false;
+ }
+ };
+ SetSkipHorizontalTransform setSkipHorizontalTransform(context);
+
verticalTransforms =
createOperations(componentsSrc[1], targetCRS, context);
bool foundRegisteredTransformWithAllGridsAvailable = false;