From 9af705d630b0cd629daa0b8a28b82ba28752aa7d Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 23 Mar 2020 19:26:56 +0100 Subject: proj_get_suggested_operation(): extra fix to behave similarly to proj_create_crs_to_crs_from_pj() --- src/iso19111/c_api.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/iso19111/c_api.cpp') diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index ec6f1dc4..17fbd079 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -7662,11 +7662,15 @@ int proj_get_suggested_operation(PJ_CONTEXT *ctx, PJ_OBJ_LIST *operations, return -1; } - int iExcluded[2] = {-1, -1}; - const auto &preparedOps = opList->getPreparedOperations(ctx); - if (preparedOps.empty() && !opList->objects.empty()) { + // Special case: + // proj_create_crs_to_crs_from_pj() always use the unique operation + // if there's a single one + if (opList->objects.size() == 1) { return 0; } + + int iExcluded[2] = {-1, -1}; + const auto &preparedOps = opList->getPreparedOperations(ctx); int idx = pj_get_suggested_operation(ctx, preparedOps, iExcluded, direction, coord); if (idx >= 0) { -- cgit v1.2.3