aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/operation/coordinateoperationfactory.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-12-14 21:12:43 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-12-14 21:12:43 +0100
commit95340fb1d1011d6864d82b60194eb77df9e9e38f (patch)
tree30e2d3909d33c04f7966f996f90c971cd7023ade /src/iso19111/operation/coordinateoperationfactory.cpp
parentbfc54bbac8550e18d352468032ad0b3d5ca2d328 (diff)
downloadPROJ-95340fb1d1011d6864d82b60194eb77df9e9e38f.tar.gz
PROJ-95340fb1d1011d6864d82b60194eb77df9e9e38f.zip
createOperations(): fix inconsistent chaining exception when transforming from BoundCRS of projected CRS based on NTF Paris to BoundCRS of geog CRS NTF Paris. Fixes https://github.com/OSGeo/gdal/issues/3273
Diffstat (limited to 'src/iso19111/operation/coordinateoperationfactory.cpp')
-rw-r--r--src/iso19111/operation/coordinateoperationfactory.cpp53
1 files changed, 16 insertions, 37 deletions
diff --git a/src/iso19111/operation/coordinateoperationfactory.cpp b/src/iso19111/operation/coordinateoperationfactory.cpp
index 1e919416..b8a9bcdf 100644
--- a/src/iso19111/operation/coordinateoperationfactory.cpp
+++ b/src/iso19111/operation/coordinateoperationfactory.cpp
@@ -4255,47 +4255,26 @@ void CoordinateOperationFactory::Private::createOperationsBoundToBound(
auto hubSrcGeog = dynamic_cast<const crs::GeographicCRS *>(hubSrc.get());
const auto &hubDst = boundDst->hubCRS();
auto hubDstGeog = dynamic_cast<const crs::GeographicCRS *>(hubDst.get());
- auto geogCRSOfBaseOfBoundSrc = boundSrc->baseCRS()->extractGeographicCRS();
- auto geogCRSOfBaseOfBoundDst = boundDst->baseCRS()->extractGeographicCRS();
if (hubSrcGeog && hubDstGeog &&
hubSrcGeog->_isEquivalentTo(hubDstGeog,
- util::IComparable::Criterion::EQUIVALENT) &&
- geogCRSOfBaseOfBoundSrc && geogCRSOfBaseOfBoundDst) {
- const bool firstIsNoOp = geogCRSOfBaseOfBoundSrc->_isEquivalentTo(
- boundSrc->baseCRS().get(),
- util::IComparable::Criterion::EQUIVALENT);
- const bool lastIsNoOp = geogCRSOfBaseOfBoundDst->_isEquivalentTo(
- boundDst->baseCRS().get(),
- util::IComparable::Criterion::EQUIVALENT);
- auto opsFirst = createOperations(
- boundSrc->baseCRS(), NN_NO_CHECK(geogCRSOfBaseOfBoundSrc), context);
- auto opsLast = createOperations(NN_NO_CHECK(geogCRSOfBaseOfBoundDst),
- boundDst->baseCRS(), context);
- if (!opsFirst.empty() && !opsLast.empty()) {
- const auto &opSecond = boundSrc->transformation();
- auto opThird = boundDst->transformation()->inverse();
- for (const auto &opFirst : opsFirst) {
- for (const auto &opLast : opsLast) {
- try {
- std::vector<CoordinateOperationNNPtr> ops;
- if (!firstIsNoOp) {
- ops.push_back(opFirst);
- }
- ops.push_back(opSecond);
- ops.push_back(opThird);
- if (!lastIsNoOp) {
- ops.push_back(opLast);
- }
- res.emplace_back(
- ConcatenatedOperation::createComputeMetadata(
- ops, disallowEmptyIntersection));
- } catch (const InvalidOperationEmptyIntersection &) {
- }
+ util::IComparable::Criterion::EQUIVALENT)) {
+ auto opsFirst = createOperations(sourceCRS, hubSrc, context);
+ auto opsLast = createOperations(hubSrc, targetCRS, context);
+ for (const auto &opFirst : opsFirst) {
+ for (const auto &opLast : opsLast) {
+ try {
+ std::vector<CoordinateOperationNNPtr> ops;
+ ops.push_back(opFirst);
+ ops.push_back(opLast);
+ res.emplace_back(
+ ConcatenatedOperation::createComputeMetadata(
+ ops, disallowEmptyIntersection));
+ } catch (const InvalidOperationEmptyIntersection &) {
}
}
- if (!res.empty()) {
- return;
- }
+ }
+ if (!res.empty()) {
+ return;
}
}