aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/apply_gridshift.cpp8
-rw-r--r--src/grids.cpp9
2 files changed, 10 insertions, 7 deletions
diff --git a/src/apply_gridshift.cpp b/src/apply_gridshift.cpp
index a0ffa394..c786a50a 100644
--- a/src/apply_gridshift.cpp
+++ b/src/apply_gridshift.cpp
@@ -212,12 +212,12 @@ PJ_LP nad_cvt(PJ_LP in, int inverse, const HorizontalShiftGrid* grid) {
return t;
if (!inverse) {
- in.lam -= t.lam;
+ in.lam += t.lam;
in.phi += t.phi;
return in;
}
- t.lam = tb.lam + t.lam;
+ t.lam = tb.lam - t.lam;
t.phi = tb.phi - t.phi;
do {
@@ -235,8 +235,8 @@ PJ_LP nad_cvt(PJ_LP in, int inverse, const HorizontalShiftGrid* grid) {
if (del.lam == HUGE_VAL)
break;
- dif.lam = t.lam - del.lam - tb.lam;
- dif.phi = t.phi + del.phi - tb.phi;
+ dif.lam = t.lam + del.lam - tb.lam;
+ dif.phi = t.phi + del.phi - tb.phi;
t.lam -= dif.lam;
t.phi -= dif.phi;
diff --git a/src/grids.cpp b/src/grids.cpp
index 7d19b1f7..cc954542 100644
--- a/src/grids.cpp
+++ b/src/grids.cpp
@@ -469,7 +469,8 @@ bool NTv1Grid::valueAt(int x, int y, float &lonShift, float &latShift) const {
}
/* convert seconds to radians */
latShift = static_cast<float>(two_doubles[0] * ((M_PI / 180.0) / 3600.0));
- lonShift = static_cast<float>(two_doubles[1] * ((M_PI / 180.0) / 3600.0));
+ // west longitude positive convention !
+ lonShift = -static_cast<float>(two_doubles[1] * ((M_PI / 180.0) / 3600.0));
return true;
}
@@ -572,7 +573,8 @@ bool CTable2Grid::valueAt(int x, int y, float &lonShift,
}
latShift = two_floats[1];
- lonShift = two_floats[0];
+ // west longitude positive convention !
+ lonShift = -two_floats[0];
return true;
}
@@ -642,7 +644,8 @@ bool NTv2Grid::valueAt(int x, int y, float &lonShift, float &latShift) const {
}
/* convert seconds to radians */
latShift = static_cast<float>(two_float[0] * ((M_PI / 180.0) / 3600.0));
- lonShift = static_cast<float>(two_float[1] * ((M_PI / 180.0) / 3600.0));
+ // west longitude positive convention !
+ lonShift = -static_cast<float>(two_float[1] * ((M_PI / 180.0) / 3600.0));
return true;
}