diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2022-02-09 16:20:22 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2022-02-09 16:26:50 +0100 |
| commit | b210728be7960e713a5558e8980af20dccc698e2 (patch) | |
| tree | 52e68b07876a60be2756f620a90c4aceee84ab13 /src/iso19111 | |
| parent | 61c918f163a7e8cfd89c6ae58c8769bb2e33b386 (diff) | |
| download | PROJ-b210728be7960e713a5558e8980af20dccc698e2.tar.gz PROJ-b210728be7960e713a5558e8980af20dccc698e2.zip | |
createOperations(): fix transformations from/to a BoundCRS of a DerivedGeographicCRS coming from WKT
Diffstat (limited to 'src/iso19111')
| -rw-r--r-- | src/iso19111/operation/transformation.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/iso19111/operation/transformation.cpp b/src/iso19111/operation/transformation.cpp index 1f399c7e..1e452d2c 100644 --- a/src/iso19111/operation/transformation.cpp +++ b/src/iso19111/operation/transformation.cpp @@ -2460,10 +2460,15 @@ static void setupPROJGeodeticSourceCRS(io::PROJStringFormatter *formatter, formatter->stopInversion(); if (util::isOfExactType<crs::DerivedGeographicCRS>( *(sourceCRSGeog.get()))) { + const auto derivedGeogCRS = + dynamic_cast<const crs::DerivedGeographicCRS *>( + sourceCRSGeog.get()); // The export of a DerivedGeographicCRS in non-CRS mode adds - // unit conversion and axis swapping. We must compensate for that + // unit conversion and axis swapping to the base CRS. + // We must compensate for that formatter->startInversion(); formatter->startInversion(); - sourceCRSGeog->addAngularUnitConvertAndAxisSwap(formatter); + derivedGeogCRS->baseCRS()->addAngularUnitConvertAndAxisSwap( + formatter); formatter->stopInversion(); } @@ -2502,8 +2507,13 @@ static void setupPROJGeodeticTargetCRS(io::PROJStringFormatter *formatter, if (util::isOfExactType<crs::DerivedGeographicCRS>( *(targetCRSGeog.get()))) { // The export of a DerivedGeographicCRS in non-CRS mode adds - // unit conversion and axis swapping. We must compensate for that - targetCRSGeog->addAngularUnitConvertAndAxisSwap(formatter); + // unit conversion and axis swapping to the base CRS. + // We must compensate for that formatter->startInversion(); + const auto derivedGeogCRS = + dynamic_cast<const crs::DerivedGeographicCRS *>( + targetCRSGeog.get()); + derivedGeogCRS->baseCRS()->addAngularUnitConvertAndAxisSwap( + formatter); } targetCRSGeog->_exportToPROJString(formatter); } else { |
