aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/operation/coordinateoperationfactory.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2022-03-17 22:18:22 +0100
committerGitHub <noreply@github.com>2022-03-17 22:18:22 +0100
commitab3383a4483f65679ae4a687cc8660572cd6102c (patch)
treeab0d528ffa0cda0f0b61f8e26936dc828b24402b /src/iso19111/operation/coordinateoperationfactory.cpp
parent1c1a3c5930229644440a7e41d032cc217cf2f8c0 (diff)
parent3e7984f3b26e408e69b960f8e0d03b6ac0576188 (diff)
downloadPROJ-ab3383a4483f65679ae4a687cc8660572cd6102c.tar.gz
PROJ-ab3383a4483f65679ae4a687cc8660572cd6102c.zip
Merge pull request #3119 from rouault/compound_to_2D_crs
Transformation: no longer do vertical trasnformation when doing compound CRS to 2D CRS / add --3d to cs2cs
Diffstat (limited to 'src/iso19111/operation/coordinateoperationfactory.cpp')
-rw-r--r--src/iso19111/operation/coordinateoperationfactory.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/iso19111/operation/coordinateoperationfactory.cpp b/src/iso19111/operation/coordinateoperationfactory.cpp
index 20042f22..a6a2c986 100644
--- a/src/iso19111/operation/coordinateoperationfactory.cpp
+++ b/src/iso19111/operation/coordinateoperationfactory.cpp
@@ -4926,6 +4926,19 @@ void CoordinateOperationFactory::Private::createOperationsCompoundToGeog(
}
}
+ // Only do a vertical transformation if the target CRS is 3D.
+ const auto dstSingle = dynamic_cast<crs::SingleCRS *>(targetCRS.get());
+ if (dstSingle &&
+ dstSingle->coordinateSystem()->axisList().size() == 2) {
+ auto tmp = createOperations(componentsSrc[0], targetCRS, context);
+ for (const auto &op : tmp) {
+ auto opClone = op->shallowClone();
+ setCRSs(opClone.get(), sourceCRS, targetCRS);
+ res.emplace_back(opClone);
+ }
+ return;
+ }
+
std::vector<CoordinateOperationNNPtr> horizTransforms;
auto srcGeogCRS = componentsSrc[0]->extractGeographicCRS();
if (srcGeogCRS) {