aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-09-28 10:19:50 +0200
committerGitHub <noreply@github.com>2019-09-28 10:19:50 +0200
commitf0c148abf30201fef9f9958d4e47c5a28d9e66b0 (patch)
tree875390985d2705928fe52658b156ccdcb60fecba /src
parentb0b21db45f0dc32c33e1e6c45ab1fe5cc1a4f3df (diff)
parent9ddf2d4cedc43840ab92ebda6040a78b1c774f81 (diff)
downloadPROJ-f0c148abf30201fef9f9958d4e47c5a28d9e66b0.tar.gz
PROJ-f0c148abf30201fef9f9958d4e47c5a28d9e66b0.zip
Merge pull request #1636 from OSGeo/backport-1633-to-6.2
Backport #1633 to 6.2
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/coordinateoperation.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index f0ebaebd..3ba5a5a2 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -10260,6 +10260,7 @@ CoordinateOperationPtr CoordinateOperationFactory::createOperation(
struct PrecomputedOpCharacteristics {
double area_{};
double accuracy_{};
+ bool isPROJExportable_ = false;
bool hasGrids_ = false;
bool gridsAvailable_ = false;
bool gridsKnown_ = false;
@@ -10268,13 +10269,14 @@ struct PrecomputedOpCharacteristics {
bool isNullTransformation_ = false;
PrecomputedOpCharacteristics() = default;
- PrecomputedOpCharacteristics(double area, double accuracy, bool hasGrids,
+ PrecomputedOpCharacteristics(double area, double accuracy,
+ bool isPROJExportable, bool hasGrids,
bool gridsAvailable, bool gridsKnown,
size_t stepCount, bool isApprox,
bool isNullTransformation)
- : area_(area), accuracy_(accuracy), hasGrids_(hasGrids),
- gridsAvailable_(gridsAvailable), gridsKnown_(gridsKnown),
- stepCount_(stepCount), isApprox_(isApprox),
+ : area_(area), accuracy_(accuracy), isPROJExportable_(isPROJExportable),
+ hasGrids_(hasGrids), gridsAvailable_(gridsAvailable),
+ gridsKnown_(gridsKnown), stepCount_(stepCount), isApprox_(isApprox),
isNullTransformation_(isNullTransformation) {}
};
@@ -10302,6 +10304,15 @@ struct SortFunction {
// CAUTION: the order of the comparisons is extremely important
// to get the intended result.
+ if (iterA->second.isPROJExportable_ &&
+ !iterB->second.isPROJExportable_) {
+ return true;
+ }
+ if (!iterA->second.isPROJExportable_ &&
+ iterB->second.isPROJExportable_) {
+ return false;
+ }
+
if (!iterA->second.isApprox_ && iterB->second.isApprox_) {
return true;
}
@@ -10679,9 +10690,21 @@ struct FilterResults {
std::string::npos ||
op->nameStr().find(BALLPARK_GEOCENTRIC_TRANSLATION) !=
std::string::npos;
+
+ bool isPROJExportable = false;
+ auto formatter = io::PROJStringFormatter::create();
+ try {
+ op->exportToPROJString(formatter.get());
+ // Grids might be missing, but at least this is something
+ // PROJ could potentially process
+ isPROJExportable = true;
+ } catch (const std::exception &) {
+ }
+
map[op.get()] = PrecomputedOpCharacteristics(
- area, getAccuracy(op), hasGrids, gridsAvailable, gridsKnown,
- stepCount, isApprox, isNullTransformation);
+ area, getAccuracy(op), isPROJExportable, hasGrids,
+ gridsAvailable, gridsKnown, stepCount, isApprox,
+ isNullTransformation);
}
// Sort !