From 64946ab103d66508bf56bf80417bb5d69876bd25 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 29 Mar 2020 23:11:20 +0200 Subject: Fix working of Helmert transform between the horizontal part of 2 compoundCRS (fixes #2108) --- src/iso19111/coordinateoperation.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 33210d24..267e9450 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -8930,6 +8930,16 @@ static void setupPROJGeodeticSourceCRS(io::PROJStringFormatter *formatter, const crs::CRSNNPtr &crs, bool addPushV3, const char *trfrm_name) { auto sourceCRSGeog = dynamic_cast(crs.get()); + if (!sourceCRSGeog) { + auto compoundCRS = dynamic_cast(crs.get()); + if (compoundCRS) { + const auto &components = compoundCRS->componentReferenceSystems(); + if (!components.empty()) { + sourceCRSGeog = dynamic_cast( + components[0].get()); + } + } + } if (sourceCRSGeog) { formatter->startInversion(); sourceCRSGeog->_exportToPROJString(formatter); @@ -8958,6 +8968,16 @@ static void setupPROJGeodeticTargetCRS(io::PROJStringFormatter *formatter, const crs::CRSNNPtr &crs, bool addPopV3, const char *trfrm_name) { auto targetCRSGeog = dynamic_cast(crs.get()); + if (!targetCRSGeog) { + auto compoundCRS = dynamic_cast(crs.get()); + if (compoundCRS) { + const auto &components = compoundCRS->componentReferenceSystems(); + if (!components.empty()) { + targetCRSGeog = dynamic_cast( + components[0].get()); + } + } + } if (targetCRSGeog) { formatter->addStep("cart"); formatter->setCurrentStepInverted(true); -- cgit v1.2.3