aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-09-26 17:34:21 +0200
committerGitHub <noreply@github.com>2019-09-26 17:34:21 +0200
commitb0b21db45f0dc32c33e1e6c45ab1fe5cc1a4f3df (patch)
tree7f493eaac0739bc10c335f35e191fcc93e9bc8af /src
parent36fb1cb5d74181475cbab9d01834059673d629f8 (diff)
parent668d882938b3e907bc3738df770f903843bf8578 (diff)
downloadPROJ-b0b21db45f0dc32c33e1e6c45ab1fe5cc1a4f3df.tar.gz
PROJ-b0b21db45f0dc32c33e1e6c45ab1fe5cc1a4f3df.zip
Merge pull request #1643 from rouault/backport-1641-to-6.2
[Backport 6.2] proj_create_crs_to_crs(): fix when there are only transformations with ballpark steps
Diffstat (limited to 'src')
-rw-r--r--src/4D_api.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp
index 70eaac6a..40cd609f 100644
--- a/src/4D_api.cpp
+++ b/src/4D_api.cpp
@@ -1137,6 +1137,8 @@ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, cons
try
{
+ bool skipDefaultTransforms = true;
+
// Iterate over source->target candidate transformations and reproject
// their long-lat bounding box into the source CRS.
for( int i = 0; i < op_count; i++ )
@@ -1149,12 +1151,25 @@ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, cons
double north_lat = 0.0;
const char* name = proj_get_name(op);
- if( name && (strstr(name, "Ballpark geographic offset") ||
+ bool canUseOp = true;
+ if( skipDefaultTransforms &&
+ name && (strstr(name, "Ballpark geographic offset") ||
strstr(name, "Ballpark geocentric translation")) )
{
- // Skip default transformations
+ // Skip default transformations unless there is already one at
+ // the beginning (in which case all of them will have one)
+ if( i == 0 )
+ {
+ skipDefaultTransforms = false;
+ }
+ else
+ {
+ canUseOp = false;
+ }
}
- else if( proj_get_area_of_use(ctx, op,
+
+ if( canUseOp &&
+ proj_get_area_of_use(ctx, op,
&west_lon, &south_lat, &east_lon, &north_lat, nullptr) )
{
if( west_lon <= east_lon )