diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-09-23 15:21:57 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-09-24 00:41:28 +0200 |
| commit | 0f4f7870d8a8db3f8036ebbc96291c66eac2cd5e (patch) | |
| tree | 75770f799881540488861e13fa76c2cd6d74099a | |
| parent | 841673c8a39613424cc8345e8e160a811c14b5be (diff) | |
| download | PROJ-0f4f7870d8a8db3f8036ebbc96291c66eac2cd5e.tar.gz PROJ-0f4f7870d8a8db3f8036ebbc96291c66eac2cd5e.zip | |
createOperations() sorting: sort operations that cannot be exported as PROJ pipelines at end
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 35 | ||||
| -rwxr-xr-x | test/cli/testprojinfo | 4 | ||||
| -rw-r--r-- | test/cli/testprojinfo_out.dist | 5 |
3 files changed, 38 insertions, 6 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 56a3b38c..bf3b5146 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -10267,6 +10267,7 @@ CoordinateOperationPtr CoordinateOperationFactory::createOperation( struct PrecomputedOpCharacteristics { double area_{}; double accuracy_{}; + bool isPROJExportable_ = false; bool hasGrids_ = false; bool gridsAvailable_ = false; bool gridsKnown_ = false; @@ -10275,13 +10276,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) {} }; @@ -10309,6 +10311,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; } @@ -10686,9 +10697,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 ! diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo index 81d0d3e4..aa373114 100755 --- a/test/cli/testprojinfo +++ b/test/cli/testprojinfo @@ -127,6 +127,10 @@ echo "Testing -s EPSG:32631 -t EPSG:4326+3855 --3d --summary" >> ${OUT} $EXE -s EPSG:32631 -t EPSG:4326+3855 --3d --summary >>${OUT} 2>&1 echo "" >>${OUT} +echo "Testing -s EPSG:4936 -t EPSG:4978 --spatial-test intersects --summary where WGS 84 to ETRS89 (2) uses a transformation method not supported by PROJ currently (time-specific Helmert), and thus must be sorted last" >> ${OUT} +$EXE -s EPSG:4936 -t EPSG:4978 --spatial-test intersects --summary >>${OUT} 2>&1 +echo "" >>${OUT} + # do 'diff' with distribution results echo "diff ${OUT} with testprojinfo_out.dist" diff -u ${OUT} ${TEST_CLI_DIR}/testprojinfo_out.dist diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index 45955d92..b8209bbb 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -934,3 +934,8 @@ unknown id, Inverse of UTM zone 31N + WGS 84 to EGM2008 height (1), 1 m, World unknown id, Inverse of UTM zone 31N + WGS 84 to EGM2008 height (2), 0.5 m, World unknown id, Inverse of UTM zone 31N + Inverse of Transformation from EGM2008 height to WGS 84 (ballpark vertical transformation, without ellipsoid height to vertical height correction), unknown accuracy, World, has ballpark transformation +Testing -s EPSG:4936 -t EPSG:4978 --spatial-test intersects --summary where WGS 84 to ETRS89 (2) uses a transformation method not supported by PROJ currently (time-specific Helmert), and thus must be sorted last +Candidate operations found: 2 +unknown id, Ballpark geocentric translation from ETRS89 to WGS 84, unknown accuracy, World, has ballpark transformation +INVERSE(EPSG):9225, Inverse of WGS 84 to ETRS89 (2), 0.1 m, Europe - offshore North Sea - Germany and Netherlands east of 5°E + |
