diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-09-17 19:46:07 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-09-17 19:46:07 +0200 |
| commit | 75074ce863e36299ec39b39decdd435eed15ad63 (patch) | |
| tree | 448fb1ab3c3152224450b6a07f723ba14623b727 /src/iso19111/coordinateoperation.cpp | |
| parent | aeb024f2df5fb1c4d83959b6b9edcb62e8385226 (diff) | |
| download | PROJ-75074ce863e36299ec39b39decdd435eed15ad63.tar.gz PROJ-75074ce863e36299ec39b39decdd435eed15ad63.zip | |
createOperations(): tune sorting of transformations so that the ones with greater 'version numbers' are prefered over other ones, when all other comparison criteria are equal. Helps with Amersfoort RD New to EPSG:4326
Diffstat (limited to 'src/iso19111/coordinateoperation.cpp')
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp index 0e61d2ee..65ef2b77 100644 --- a/src/iso19111/coordinateoperation.cpp +++ b/src/iso19111/coordinateoperation.cpp @@ -11380,8 +11380,31 @@ struct SortFunction { return false; } - // Arbitrary final criterion - return a_name < b_name; + // Arbitrary final criterion. We actually return the greater element + // first, so that "Amersfoort to WGS 84 (4)" is presented before + // "Amersfoort to WGS 84 (3)", which is probably a better guess. + + // Except for French NTF (Paris) to NTF, where the (1) conversion + // should be preferred because in the remarks of (2), it is mentionned + // OGP prefers value from IGN Paris (code 1467)... + if (a_name.find("NTF (Paris) to NTF (1)") != std::string::npos && + b_name.find("NTF (Paris) to NTF (2)") != std::string::npos) { + return true; + } + if (a_name.find("NTF (Paris) to NTF (2)") != std::string::npos && + b_name.find("NTF (Paris) to NTF (1)") != std::string::npos) { + return false; + } + if (a_name.find("NTF (Paris) to RGF93 (1)") != std::string::npos && + b_name.find("NTF (Paris) to RGF93 (2)") != std::string::npos) { + return true; + } + if (a_name.find("NTF (Paris) to RGF93 (2)") != std::string::npos && + b_name.find("NTF (Paris) to RGF93 (1)") != std::string::npos) { + return false; + } + + return a_name > b_name; } bool operator()(const CoordinateOperationNNPtr &a, |
