diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-12-28 22:58:59 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-12-28 22:58:59 +0100 |
| commit | 9b2b96ef7a343831753679567893d85998e9c9ea (patch) | |
| tree | 48d537a741465debf07117f0c966f1170c8096ff /src | |
| parent | 43f019a17b4d170544c35d6c1a47839fcd654052 (diff) | |
| download | PROJ-9b2b96ef7a343831753679567893d85998e9c9ea.tar.gz PROJ-9b2b96ef7a343831753679567893d85998e9c9ea.zip | |
Operation computation: better take into account when candidate operations have no declared extent
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index b0d26cc0..6a3062c5 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -9595,7 +9595,7 @@ struct FilterResults { sourceAndTargetCRSExtentUse( context->getSourceAndTargetCRSExtentUse()) { - computeAreaOfIntest(); + computeAreaOfInterest(); filterOut(forceStrictContainmentTest); } @@ -9634,7 +9634,7 @@ struct FilterResults { std::vector<CoordinateOperationNNPtr> res{}; // ---------------------------------------------------------------------- - void computeAreaOfIntest() { + void computeAreaOfInterest() { // Compute an area of interest from the CRS extent if the user did // not specify one @@ -9676,6 +9676,7 @@ struct FilterResults { ? CoordinateOperationContext::SpatialCriterion:: STRICT_CONTAINMENT : context->getSpatialCriterion(); + bool hasFoundOpWithExtent = false; for (const auto &op : sourceList) { if (desiredAccuracy != 0) { const double accuracy = getAccuracy(op); @@ -9688,6 +9689,7 @@ struct FilterResults { auto extent = getExtent(op, true, emptyIntersection); if (!extent) continue; + hasFoundOpWithExtent = true; bool extentContains = extent->contains(NN_NO_CHECK(areaOfInterest)); if (extentContains) { @@ -9712,6 +9714,7 @@ struct FilterResults { auto extent = getExtent(op, true, emptyIntersection); if (!extent) continue; + hasFoundOpWithExtent = true; bool extentContainsSource = !sourceCRSExtent || extent->contains(NN_NO_CHECK(sourceCRSExtent)); @@ -9743,6 +9746,20 @@ struct FilterResults { } res.emplace_back(op); } + + // In case no operation has an extent and no result is found, + // retain all initial operations that match accuracy criterion. + if (res.empty() && !hasFoundOpWithExtent) { + for (const auto &op : sourceList) { + if (desiredAccuracy != 0) { + const double accuracy = getAccuracy(op); + if (accuracy < 0 || accuracy > desiredAccuracy) { + continue; + } + } + res.emplace_back(op); + } + } } // ---------------------------------------------------------------------- |
