diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-04-25 22:03:41 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-04-25 22:03:41 +0200 |
| commit | 0dc275a312c1b2ddefc066c66787eb8274d60f08 (patch) | |
| tree | 7b6b030d8c782e17ebf7de4a99802487882488dc /src/pj_transform.c | |
| parent | 968fcad7ae5064e733978f47d5e93a9baf6a5c46 (diff) | |
| download | PROJ-0dc275a312c1b2ddefc066c66787eb8274d60f08.tar.gz PROJ-0dc275a312c1b2ddefc066c66787eb8274d60f08.zip | |
pj_transform: reset error state before each call to pj_inv/pj_fwd
Fixes issues raised in https://lists.osgeo.org/pipermail/gdal-dev/2018-April/048446.html
The use case is that pj_transform() is called from geos projection to something else,
with multiple coordinates. If one of the coordinate tuple fails the inverse
transform of geos, it fails with PJD_ERR_TOLERANCE_CONDITION. Causing all following
coordinates to fail since the error state is not reset.
Diffstat (limited to 'src/pj_transform.c')
| -rw-r--r-- | src/pj_transform.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pj_transform.c b/src/pj_transform.c index 22b685b2..aaa8c1e4 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -42,6 +42,8 @@ enum PJ_DIRECTION { }; typedef enum PJ_DIRECTION PJ_DIRECTION; +/* Copied from proj.h FIXME */ +int proj_errno_reset (const PJ *P); static int adjust_axis( projCtx ctx, const char *axis, int denormalize_flag, @@ -199,6 +201,7 @@ static int geographic_to_projected (PJ *P, long n, int dist, double *x, double * if (geodetic_loc.u == HUGE_VAL) continue; + proj_errno_reset( P ); projected_loc = pj_fwd3d( geodetic_loc, P); if( P->ctx->last_errno != 0 ) { @@ -234,6 +237,7 @@ static int geographic_to_projected (PJ *P, long n, int dist, double *x, double * if( geodetic_loc.u == HUGE_VAL ) continue; + proj_errno_reset( P ); projected_loc = pj_fwd( geodetic_loc, P ); if( P->ctx->last_errno != 0 ) { @@ -301,6 +305,7 @@ static int projected_to_geographic (PJ *P, long n, int dist, double *x, double * if (projected_loc.u == HUGE_VAL) continue; + proj_errno_reset( P ); geodetic_loc = pj_inv3d(projected_loc, P); if( P->ctx->last_errno != 0 ) { @@ -337,6 +342,7 @@ static int projected_to_geographic (PJ *P, long n, int dist, double *x, double * if( projected_loc.u == HUGE_VAL ) continue; + proj_errno_reset( P ); geodetic_loc = pj_inv( projected_loc, P ); if( P->ctx->last_errno != 0 ) { |
