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-13 12:19:57 +0200
commitf168e2397eb7ac01bb1ec5bd1f08e27ff0a8a8d2 (patch)
treea056ab6373ea4f843d416db16cd2f0306c374826 /src
parent29a5cae676cf0bcd8226933512ac23a91faa6654 (diff)
downloadPROJ-f168e2397eb7ac01bb1ec5bd1f08e27ff0a8a8d2.tar.gz
PROJ-f168e2397eb7ac01bb1ec5bd1f08e27ff0a8a8d2.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 d5b766ad..f0ebaebd 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -10172,6 +10172,7 @@ struct CoordinateOperationFactory::Private {
const CoordinateOperationContextNNPtr &context;
bool inCreateOperationsWithDatumPivotAntiRecursion = false;
bool inCreateOperationsGeogToVertWithIntermediate = false;
+ bool skipHorizontalTransformation = false;
Context(const crs::CRSNNPtr &sourceCRSIn,
const crs::CRSNNPtr &targetCRSIn,
@@ -12599,27 +12600,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;
+ }
}
}
}
@@ -12841,6 +12847,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;