aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2022-03-19 12:20:21 +0100
committerGitHub <noreply@github.com>2022-03-19 12:20:21 +0100
commit8c51e3c99acc9083d82a5a7a6dae146e2a689f8e (patch)
tree2a966abbe57276db269888e443a4a18d69c8f2d2 /src
parent278b0f931a11d668a1c0abe796e8cd64da4db17c (diff)
parentd37884e00f27907464675558b2da529729299dcf (diff)
downloadPROJ-8c51e3c99acc9083d82a5a7a6dae146e2a689f8e.tar.gz
PROJ-8c51e3c99acc9083d82a5a7a6dae146e2a689f8e.zip
Merge pull request #3123 from rouault/fix_compound_crs_nad83_csrs
createOperations(): fix transformation involving CompoundCRS, ToWGS84 and PROJ4_GRIDS
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/operation/coordinateoperationfactory.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/iso19111/operation/coordinateoperationfactory.cpp b/src/iso19111/operation/coordinateoperationfactory.cpp
index a6a2c986..d5869331 100644
--- a/src/iso19111/operation/coordinateoperationfactory.cpp
+++ b/src/iso19111/operation/coordinateoperationfactory.cpp
@@ -5097,6 +5097,28 @@ void CoordinateOperationFactory::Private::createOperationsCompoundToGeog(
componentsSrc[0], NN_NO_CHECK(interpolationGeogCRS),
context);
+ // e.g when doing COMPOUND_CRS[
+ // NAD83(CRS)+TOWGS84[0,0,0],
+ // CGVD28 height + EXTENSION["PROJ4_GRIDS","HT2_0.gtx"]
+ // to NAD83(CRS) 3D
+ const auto boundSrc =
+ dynamic_cast<crs::BoundCRS *>(componentsSrc[0].get());
+ if (boundSrc &&
+ boundSrc->baseCRS()->isEquivalentTo(
+ targetCRS->demoteTo2D(std::string(), dbContext)
+ .get(),
+ util::IComparable::Criterion::EQUIVALENT) &&
+ boundSrc->hubCRS()->isEquivalentTo(
+ interpolationGeogCRS
+ ->demoteTo2D(std::string(), dbContext)
+ .get(),
+ util::IComparable::Criterion::EQUIVALENT)) {
+ // Make sure to use the same horizontal transformation
+ // (likely a null shift)
+ interpToTargetOps = applyInverse(srcToInterpOps);
+ return;
+ }
+
// But do the interpolation CRS to targetCRS in 3D
// to have proper ellipsoid height transformation.
// We need to force the vertical axis of this 3D'ified