aboutsummaryrefslogtreecommitdiff
path: root/src/4D_api.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-06-18 14:24:38 +0200
committerGitHub <noreply@github.com>2021-06-18 14:24:38 +0200
commita79b5558da1a391a9d7418316c9f507583d41b2a (patch)
treefad8a3d7e89f21d9581b6404ec370b0865b989eb /src/4D_api.cpp
parent987c8e9a4521c3e80fac73dbaa76ff77747d854b (diff)
parent916eaa4349e2f46320d49ae0f9d2993d98a8335d (diff)
downloadPROJ-a79b5558da1a391a9d7418316c9f507583d41b2a.tar.gz
PROJ-a79b5558da1a391a9d7418316c9f507583d41b2a.zip
Merge pull request #2750 from rouault/better_operation_selection
proj_trans/cs2cs: If two operations have the same accuracy, use the one that is contained within a larger one
Diffstat (limited to 'src/4D_api.cpp')
-rw-r--r--src/4D_api.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp
index 8b676f9b..95582e48 100644
--- a/src/4D_api.cpp
+++ b/src/4D_api.cpp
@@ -243,7 +243,15 @@ int pj_get_suggested_operation(PJ_CONTEXT*,
// onshore. So in a general way, prefer a onshore area to a
// offshore one.
if( iBest < 0 ||
- (alt.accuracy >= 0 && alt.accuracy < bestAccuracy &&
+ (alt.accuracy >= 0 &&
+ (alt.accuracy < bestAccuracy ||
+ // If two operations have the same accuracy, use the one that
+ // is contained within a larger one
+ (alt.accuracy == bestAccuracy &&
+ alt.minxSrc > opList[iBest].minxSrc &&
+ alt.minySrc > opList[iBest].minySrc &&
+ alt.maxxSrc < opList[iBest].maxxSrc &&
+ alt.maxySrc < opList[iBest].maxySrc)) &&
!alt.isOffshore) ) {
iBest = i;
bestAccuracy = alt.accuracy;