proj4 2.15.0 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-and-test.yml +45 -7
- package/.nyc_output/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +1 -0
- package/.nyc_output/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +1 -0
- package/.nyc_output/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +1 -0
- package/.nyc_output/processinfo/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +1 -0
- package/.nyc_output/processinfo/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +1 -0
- package/.nyc_output/processinfo/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/Gruntfile.js +20 -84
- package/README.md +20 -6
- package/bower.json +1 -1
- package/component.json +1 -1
- package/dist/proj4-src.js +8934 -7083
- package/dist/proj4.js +1 -1
- package/eslint.config.mjs +41 -0
- package/lib/Point.js +4 -4
- package/lib/Proj.js +7 -8
- package/lib/adjust_axis.js +30 -33
- package/lib/common/acosh.js +2 -2
- package/lib/common/adjust_lat.js +2 -2
- package/lib/common/adjust_lon.js +2 -3
- package/lib/common/adjust_zone.js +1 -1
- package/lib/common/asinh.js +2 -2
- package/lib/common/asinhy.js +1 -1
- package/lib/common/asinz.js +2 -2
- package/lib/common/atanh.js +2 -2
- package/lib/common/clens.js +1 -1
- package/lib/common/clens_cmplx.js +1 -1
- package/lib/common/cosh.js +2 -2
- package/lib/common/e0fn.js +2 -2
- package/lib/common/e1fn.js +2 -2
- package/lib/common/e2fn.js +2 -2
- package/lib/common/e3fn.js +2 -2
- package/lib/common/fL.js +2 -2
- package/lib/common/gN.js +2 -2
- package/lib/common/gatg.js +1 -1
- package/lib/common/hypot.js +1 -1
- package/lib/common/imlfn.js +3 -3
- package/lib/common/invlatiso.js +2 -2
- package/lib/common/iqsfnz.js +5 -6
- package/lib/common/latiso.js +2 -2
- package/lib/common/log1py.js +1 -1
- package/lib/common/mlfn.js +2 -2
- package/lib/common/msfnz.js +2 -2
- package/lib/common/phi2z.js +3 -3
- package/lib/common/pj_enfn.js +2 -2
- package/lib/common/pj_inv_mlfn.js +6 -6
- package/lib/common/pj_mlfn.js +2 -2
- package/lib/common/qsfnz.js +3 -4
- package/lib/common/sign.js +3 -3
- package/lib/common/sinh.js +2 -2
- package/lib/common/srat.js +2 -2
- package/lib/common/tanh.js +2 -2
- package/lib/common/toPoint.js +4 -4
- package/lib/common/tsfnz.js +2 -2
- package/lib/constants/Datum.js +1228 -46
- package/lib/constants/Ellipsoid.js +225 -266
- package/lib/constants/PrimeMeridian.js +14 -14
- package/lib/constants/units.js +20 -20
- package/lib/constants/values.js +4 -4
- package/lib/core.js +2 -2
- package/lib/datum.js +2 -2
- package/lib/datumUtils.js +9 -14
- package/lib/datum_transform.js +26 -26
- package/lib/defs.js +10 -20
- package/lib/deriveConstants.js +4 -2
- package/lib/extend.js +1 -1
- package/lib/global.js +6 -6
- package/lib/includedProjections.js +25 -25
- package/lib/index.js +9 -9
- package/lib/nadgrid.js +36 -14
- package/lib/parseCode.js +10 -11
- package/lib/projString.js +41 -44
- package/lib/projections/aea.js +7 -12
- package/lib/projections/aeqd.js +51 -86
- package/lib/projections/bonne.js +11 -13
- package/lib/projections/cass.js +8 -15
- package/lib/projections/cea.js +7 -9
- package/lib/projections/eqc.js +2 -5
- package/lib/projections/eqdc.js +10 -16
- package/lib/projections/eqearth.js +17 -17
- package/lib/projections/equi.js +4 -6
- package/lib/projections/etmerc.js +9 -11
- package/lib/projections/gauss.js +3 -3
- package/lib/projections/geocent.js +13 -14
- package/lib/projections/geos.js +136 -137
- package/lib/projections/gnom.js +8 -13
- package/lib/projections/gstmerc.js +2 -5
- package/lib/projections/krovak.js +3 -3
- package/lib/projections/laea.js +85 -97
- package/lib/projections/lcc.js +28 -33
- package/lib/projections/longlat.js +4 -4
- package/lib/projections/merc.js +12 -19
- package/lib/projections/mill.js +6 -7
- package/lib/projections/moll.js +8 -9
- package/lib/projections/nzmg.js +2 -2
- package/lib/projections/omerc.js +55 -57
- package/lib/projections/ortho.js +9 -10
- package/lib/projections/poly.js +13 -21
- package/lib/projections/qsc.js +19 -21
- package/lib/projections/robin.js +118 -118
- package/lib/projections/sinu.js +12 -23
- package/lib/projections/somerc.js +3 -3
- package/lib/projections/stere.js +29 -41
- package/lib/projections/sterea.js +3 -4
- package/lib/projections/tmerc.js +29 -36
- package/lib/projections/tpers.js +14 -15
- package/lib/projections/utm.js +3 -4
- package/lib/projections/vandg.js +15 -21
- package/lib/projections.js +12 -4
- package/lib/transform.js +3 -3
- package/package.json +29 -22
- package/projs.js +2 -2
- package/publish.sh +2 -2
- package/rollup.config.mjs +29 -0
- package/scripts/readme.md +10 -0
- package/scripts/updateDatums.mjs +119 -0
- package/scripts/updateEllipsoids.mjs +70 -0
- package/test/ntv2_0_downsampled_no_error_columns.gsb +0 -0
- package/test/opt.html +27 -24
- package/test/puppeteer-tests.mjs +110 -0
- package/test/test-ci.mjs +10 -0
- package/test/test.js +197 -125
- package/test/testData.js +1802 -312
- package/.jshintrc +0 -12
- package/test/amd.html +0 -63
- package/test/package.json.js +0 -1
package/lib/projections/robin.js
CHANGED
|
@@ -2,157 +2,157 @@
|
|
|
2
2
|
// Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c
|
|
3
3
|
// Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
|
|
4
4
|
|
|
5
|
-
import {HALF_PI, D2R, R2D, EPSLN} from '../constants/values';
|
|
5
|
+
import { HALF_PI, D2R, R2D, EPSLN } from '../constants/values';
|
|
6
6
|
import adjust_lon from '../common/adjust_lon';
|
|
7
7
|
|
|
8
8
|
var COEFS_X = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
[1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],
|
|
10
|
+
[0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],
|
|
11
|
+
[0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],
|
|
12
|
+
[0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],
|
|
13
|
+
[0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],
|
|
14
|
+
[0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],
|
|
15
|
+
[0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],
|
|
16
|
+
[0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],
|
|
17
|
+
[0.9216, -0.00467746, -0.00010457, 4.81243e-06],
|
|
18
|
+
[0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],
|
|
19
|
+
[0.8679, -0.00609363, -0.000113898, 3.32484e-06],
|
|
20
|
+
[0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],
|
|
21
|
+
[0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],
|
|
22
|
+
[0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],
|
|
23
|
+
[0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],
|
|
24
|
+
[0.6732, -0.00986209, -0.000199569, 1.91974e-05],
|
|
25
|
+
[0.6213, -0.010418, 8.83923e-05, 6.24051e-06],
|
|
26
|
+
[0.5722, -0.00906601, 0.000182, 6.24051e-06],
|
|
27
|
+
[0.5322, -0.00677797, 0.000275608, 6.24051e-06]
|
|
28
28
|
];
|
|
29
29
|
|
|
30
30
|
var COEFS_Y = [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
[-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],
|
|
32
|
+
[0.0620, 0.0124, -1.26793e-09, 4.22642e-10],
|
|
33
|
+
[0.1240, 0.0124, 5.07171e-09, -1.60604e-09],
|
|
34
|
+
[0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],
|
|
35
|
+
[0.2480, 0.0124002, 7.10039e-08, -2.24e-08],
|
|
36
|
+
[0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],
|
|
37
|
+
[0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],
|
|
38
|
+
[0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],
|
|
39
|
+
[0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],
|
|
40
|
+
[0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],
|
|
41
|
+
[0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],
|
|
42
|
+
[0.6769, 0.011713, -3.20223e-05, -5.16405e-07],
|
|
43
|
+
[0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],
|
|
44
|
+
[0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],
|
|
45
|
+
[0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],
|
|
46
|
+
[0.8936, 0.00969686, -6.4636e-05, -8.547e-06],
|
|
47
|
+
[0.9394, 0.00840947, -0.000192841, -4.2106e-06],
|
|
48
|
+
[0.9761, 0.00616527, -0.000256, -4.2106e-06],
|
|
49
|
+
[1.0000, 0.00328947, -0.000319159, -4.2106e-06]
|
|
50
50
|
];
|
|
51
51
|
|
|
52
52
|
var FXC = 0.8487;
|
|
53
53
|
var FYC = 1.3523;
|
|
54
|
-
var C1 = R2D/5; // rad to 5-degree interval
|
|
55
|
-
var RC1 = 1/C1;
|
|
54
|
+
var C1 = R2D / 5; // rad to 5-degree interval
|
|
55
|
+
var RC1 = 1 / C1;
|
|
56
56
|
var NODES = 18;
|
|
57
57
|
|
|
58
|
-
var poly3_val = function(coefs, x) {
|
|
59
|
-
|
|
58
|
+
var poly3_val = function (coefs, x) {
|
|
59
|
+
return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
var poly3_der = function(coefs, x) {
|
|
63
|
-
|
|
62
|
+
var poly3_der = function (coefs, x) {
|
|
63
|
+
return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
function newton_rapshon(f_df, start, max_err, iters) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
67
|
+
var x = start;
|
|
68
|
+
for (; iters; --iters) {
|
|
69
|
+
var upd = f_df(x);
|
|
70
|
+
x -= upd;
|
|
71
|
+
if (Math.abs(upd) < max_err) {
|
|
72
|
+
break;
|
|
74
73
|
}
|
|
75
|
-
|
|
74
|
+
}
|
|
75
|
+
return x;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export function init() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
this.x0 = this.x0 || 0;
|
|
80
|
+
this.y0 = this.y0 || 0;
|
|
81
|
+
this.long0 = this.long0 || 0;
|
|
82
|
+
this.es = 0;
|
|
83
|
+
this.title = this.title || 'Robinson';
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export function forward(ll) {
|
|
87
|
-
|
|
87
|
+
var lon = adjust_lon(ll.x - this.long0);
|
|
88
|
+
|
|
89
|
+
var dphi = Math.abs(ll.y);
|
|
90
|
+
var i = Math.floor(dphi * C1);
|
|
91
|
+
if (i < 0) {
|
|
92
|
+
i = 0;
|
|
93
|
+
} else if (i >= NODES) {
|
|
94
|
+
i = NODES - 1;
|
|
95
|
+
}
|
|
96
|
+
dphi = R2D * (dphi - RC1 * i);
|
|
97
|
+
var xy = {
|
|
98
|
+
x: poly3_val(COEFS_X[i], dphi) * lon,
|
|
99
|
+
y: poly3_val(COEFS_Y[i], dphi)
|
|
100
|
+
};
|
|
101
|
+
if (ll.y < 0) {
|
|
102
|
+
xy.y = -xy.y;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
xy.x = xy.x * this.a * FXC + this.x0;
|
|
106
|
+
xy.y = xy.y * this.a * FYC + this.y0;
|
|
107
|
+
return xy;
|
|
108
|
+
}
|
|
88
109
|
|
|
89
|
-
|
|
90
|
-
|
|
110
|
+
export function inverse(xy) {
|
|
111
|
+
var ll = {
|
|
112
|
+
x: (xy.x - this.x0) / (this.a * FXC),
|
|
113
|
+
y: Math.abs(xy.y - this.y0) / (this.a * FYC)
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
if (ll.y >= 1) { // pathologic case
|
|
117
|
+
ll.x /= COEFS_X[NODES][0];
|
|
118
|
+
ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
|
|
119
|
+
} else {
|
|
120
|
+
// find table interval
|
|
121
|
+
var i = Math.floor(ll.y * NODES);
|
|
91
122
|
if (i < 0) {
|
|
92
|
-
|
|
123
|
+
i = 0;
|
|
93
124
|
} else if (i >= NODES) {
|
|
94
|
-
|
|
125
|
+
i = NODES - 1;
|
|
95
126
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
for (;;) {
|
|
128
|
+
if (COEFS_Y[i][0] > ll.y) {
|
|
129
|
+
--i;
|
|
130
|
+
} else if (COEFS_Y[i + 1][0] <= ll.y) {
|
|
131
|
+
++i;
|
|
132
|
+
} else {
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
103
135
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (ll.y >= 1) { // pathologic case
|
|
117
|
-
ll.x /= COEFS_X[NODES][0];
|
|
118
|
-
ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
|
|
119
|
-
} else {
|
|
120
|
-
// find table interval
|
|
121
|
-
var i = Math.floor(ll.y * NODES);
|
|
122
|
-
if (i < 0) {
|
|
123
|
-
i = 0;
|
|
124
|
-
} else if (i >= NODES) {
|
|
125
|
-
i = NODES - 1;
|
|
126
|
-
}
|
|
127
|
-
for (;;) {
|
|
128
|
-
if (COEFS_Y[i][0] > ll.y) {
|
|
129
|
-
--i;
|
|
130
|
-
} else if (COEFS_Y[i+1][0] <= ll.y) {
|
|
131
|
-
++i;
|
|
132
|
-
} else {
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// linear interpolation in 5 degree interval
|
|
137
|
-
var coefs = COEFS_Y[i];
|
|
138
|
-
var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);
|
|
139
|
-
// find t so that poly3_val(coefs, t) = ll.y
|
|
140
|
-
t = newton_rapshon(function(x) {
|
|
141
|
-
return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
|
|
142
|
-
}, t, EPSLN, 100);
|
|
143
|
-
|
|
144
|
-
ll.x /= poly3_val(COEFS_X[i], t);
|
|
145
|
-
ll.y = (5 * i + t) * D2R;
|
|
146
|
-
if (xy.y < 0) {
|
|
147
|
-
ll.y = -ll.y;
|
|
148
|
-
}
|
|
136
|
+
// linear interpolation in 5 degree interval
|
|
137
|
+
var coefs = COEFS_Y[i];
|
|
138
|
+
var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i + 1][0] - coefs[0]);
|
|
139
|
+
// find t so that poly3_val(coefs, t) = ll.y
|
|
140
|
+
t = newton_rapshon(function (x) {
|
|
141
|
+
return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
|
|
142
|
+
}, t, EPSLN, 100);
|
|
143
|
+
|
|
144
|
+
ll.x /= poly3_val(COEFS_X[i], t);
|
|
145
|
+
ll.y = (5 * i + t) * D2R;
|
|
146
|
+
if (xy.y < 0) {
|
|
147
|
+
ll.y = -ll.y;
|
|
149
148
|
}
|
|
149
|
+
}
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
ll.x = adjust_lon(ll.x + this.long0);
|
|
152
|
+
return ll;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
export var names = [
|
|
155
|
+
export var names = ['Robinson', 'robin'];
|
|
156
156
|
export default {
|
|
157
157
|
init: init,
|
|
158
158
|
forward: forward,
|
package/lib/projections/sinu.js
CHANGED
|
@@ -4,44 +4,39 @@ import pj_enfn from '../common/pj_enfn';
|
|
|
4
4
|
var MAX_ITER = 20;
|
|
5
5
|
import pj_mlfn from '../common/pj_mlfn';
|
|
6
6
|
import pj_inv_mlfn from '../common/pj_inv_mlfn';
|
|
7
|
-
import {EPSLN, HALF_PI} from '../constants/values';
|
|
7
|
+
import { EPSLN, HALF_PI } from '../constants/values';
|
|
8
8
|
|
|
9
9
|
import asinz from '../common/asinz';
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
export function init() {
|
|
13
12
|
/* Place parameters in static storage for common use
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
------------------------------------------------- */
|
|
16
14
|
|
|
17
15
|
if (!this.sphere) {
|
|
18
16
|
this.en = pj_enfn(this.es);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
17
|
+
} else {
|
|
21
18
|
this.n = 1;
|
|
22
19
|
this.m = 0;
|
|
23
20
|
this.es = 0;
|
|
24
21
|
this.C_y = Math.sqrt((this.m + 1) / this.n);
|
|
25
22
|
this.C_x = this.C_y / (this.m + 1);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
/* Sinusoidal forward equations--mapping lat,long to x,y
|
|
31
|
-
|
|
27
|
+
----------------------------------------------------- */
|
|
32
28
|
export function forward(p) {
|
|
33
29
|
var x, y;
|
|
34
30
|
var lon = p.x;
|
|
35
31
|
var lat = p.y;
|
|
36
32
|
/* Forward equations
|
|
37
|
-
|
|
33
|
+
----------------- */
|
|
38
34
|
lon = adjust_lon(lon - this.long0);
|
|
39
35
|
|
|
40
36
|
if (this.sphere) {
|
|
41
37
|
if (!this.m) {
|
|
42
38
|
lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
39
|
+
} else {
|
|
45
40
|
var k = this.n * Math.sin(lat);
|
|
46
41
|
for (var i = MAX_ITER; i; --i) {
|
|
47
42
|
var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
|
|
@@ -53,10 +48,7 @@ export function forward(p) {
|
|
|
53
48
|
}
|
|
54
49
|
x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
|
|
55
50
|
y = this.a * this.C_y * lat;
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
|
|
51
|
+
} else {
|
|
60
52
|
var s = Math.sin(lat);
|
|
61
53
|
var c = Math.cos(lat);
|
|
62
54
|
y = this.a * pj_mlfn(lat, s, c, this.en);
|
|
@@ -81,23 +73,20 @@ export function inverse(p) {
|
|
|
81
73
|
lon = lon / (this.C_x * (this.m + Math.cos(lat)));
|
|
82
74
|
if (this.m) {
|
|
83
75
|
lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
|
|
84
|
-
}
|
|
85
|
-
else if (this.n !== 1) {
|
|
76
|
+
} else if (this.n !== 1) {
|
|
86
77
|
lat = asinz(Math.sin(lat) / this.n);
|
|
87
78
|
}
|
|
88
79
|
lon = adjust_lon(lon + this.long0);
|
|
89
80
|
lat = adjust_lat(lat);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
81
|
+
} else {
|
|
92
82
|
lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
|
|
93
83
|
s = Math.abs(lat);
|
|
94
84
|
if (s < HALF_PI) {
|
|
95
85
|
s = Math.sin(lat);
|
|
96
86
|
temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
|
|
97
|
-
//temp = this.long0 + p.x / (this.a * Math.cos(lat));
|
|
87
|
+
// temp = this.long0 + p.x / (this.a * Math.cos(lat));
|
|
98
88
|
lon = adjust_lon(temp);
|
|
99
|
-
}
|
|
100
|
-
else if ((s - EPSLN) < HALF_PI) {
|
|
89
|
+
} else if ((s - EPSLN) < HALF_PI) {
|
|
101
90
|
lon = this.long0;
|
|
102
91
|
}
|
|
103
92
|
}
|
|
@@ -106,7 +95,7 @@ export function inverse(p) {
|
|
|
106
95
|
return p;
|
|
107
96
|
}
|
|
108
97
|
|
|
109
|
-
export var names = [
|
|
98
|
+
export var names = ['Sinusoidal', 'sinu'];
|
|
110
99
|
export default {
|
|
111
100
|
init: init,
|
|
112
101
|
forward: forward,
|
|
@@ -63,10 +63,10 @@ export function inverse(p) {
|
|
|
63
63
|
var iteration = 0;
|
|
64
64
|
while (Math.abs(phy - prevPhy) > 0.0000001) {
|
|
65
65
|
if (++iteration > 20) {
|
|
66
|
-
|
|
66
|
+
// ...reportError("omercFwdInfinity");
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
//S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
|
|
69
|
+
// S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
|
|
70
70
|
S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));
|
|
71
71
|
prevPhy = phy;
|
|
72
72
|
phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
|
|
@@ -77,7 +77,7 @@ export function inverse(p) {
|
|
|
77
77
|
return p;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export var names = [
|
|
80
|
+
export var names = ['somerc'];
|
|
81
81
|
export default {
|
|
82
82
|
init: init,
|
|
83
83
|
forward: forward,
|
package/lib/projections/stere.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {EPSLN, HALF_PI} from '../constants/values';
|
|
1
|
+
import { EPSLN, HALF_PI } from '../constants/values';
|
|
2
2
|
|
|
3
3
|
import sign from '../common/sign';
|
|
4
4
|
import msfnz from '../common/msfnz';
|
|
@@ -12,7 +12,6 @@ export function ssfn_(phit, sinphi, eccen) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function init() {
|
|
15
|
-
|
|
16
15
|
// setting default parameters
|
|
17
16
|
this.x0 = this.x0 || 0;
|
|
18
17
|
this.y0 = this.y0 || 0;
|
|
@@ -25,17 +24,15 @@ export function init() {
|
|
|
25
24
|
if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
|
|
26
25
|
this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
|
|
27
26
|
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
27
|
+
} else {
|
|
30
28
|
if (Math.abs(this.coslat0) <= EPSLN) {
|
|
31
29
|
if (this.lat0 > 0) {
|
|
32
|
-
//North pole
|
|
33
|
-
//trace('stere:north pole');
|
|
30
|
+
// North pole
|
|
31
|
+
// trace('stere:north pole');
|
|
34
32
|
this.con = 1;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
//trace('stere:south pole');
|
|
33
|
+
} else {
|
|
34
|
+
// South pole
|
|
35
|
+
// trace('stere:south pole');
|
|
39
36
|
this.con = -1;
|
|
40
37
|
}
|
|
41
38
|
}
|
|
@@ -62,20 +59,19 @@ export function forward(p) {
|
|
|
62
59
|
var dlon = adjust_lon(lon - this.long0);
|
|
63
60
|
|
|
64
61
|
if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
|
|
65
|
-
//case of the origine point
|
|
66
|
-
//trace('stere:this is the origin point');
|
|
62
|
+
// case of the origine point
|
|
63
|
+
// trace('stere:this is the origin point');
|
|
67
64
|
p.x = NaN;
|
|
68
65
|
p.y = NaN;
|
|
69
66
|
return p;
|
|
70
67
|
}
|
|
71
68
|
if (this.sphere) {
|
|
72
|
-
//trace('stere:sphere case');
|
|
69
|
+
// trace('stere:sphere case');
|
|
73
70
|
A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
|
|
74
71
|
p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
|
|
75
72
|
p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
|
|
76
73
|
return p;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
74
|
+
} else {
|
|
79
75
|
X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
|
|
80
76
|
cosX = Math.cos(X);
|
|
81
77
|
sinX = Math.sin(X);
|
|
@@ -84,24 +80,22 @@ export function forward(p) {
|
|
|
84
80
|
rh = 2 * this.a * this.k0 * ts / this.cons;
|
|
85
81
|
p.x = this.x0 + rh * Math.sin(lon - this.long0);
|
|
86
82
|
p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
|
|
87
|
-
//trace(p.toString());
|
|
83
|
+
// trace(p.toString());
|
|
88
84
|
return p;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
//trace('stere:equateur');
|
|
85
|
+
} else if (Math.abs(this.sinlat0) < EPSLN) {
|
|
86
|
+
// Eq
|
|
87
|
+
// trace('stere:equateur');
|
|
93
88
|
A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
|
|
94
89
|
p.y = A * sinX;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
//trace('stere:normal case');
|
|
90
|
+
} else {
|
|
91
|
+
// other case
|
|
92
|
+
// trace('stere:normal case');
|
|
99
93
|
A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
|
|
100
94
|
p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
|
|
101
95
|
}
|
|
102
96
|
p.x = A * cosX * Math.sin(dlon) + this.x0;
|
|
103
97
|
}
|
|
104
|
-
//trace(p.toString());
|
|
98
|
+
// trace(p.toString());
|
|
105
99
|
return p;
|
|
106
100
|
}
|
|
107
101
|
|
|
@@ -123,42 +117,37 @@ export function inverse(p) {
|
|
|
123
117
|
lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
|
|
124
118
|
if (Math.abs(this.coslat0) < EPSLN) {
|
|
125
119
|
if (this.lat0 > 0) {
|
|
126
|
-
lon = adjust_lon(this.long0 + Math.atan2(p.x, -
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
120
|
+
lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y));
|
|
121
|
+
} else {
|
|
129
122
|
lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
|
|
130
123
|
}
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
124
|
+
} else {
|
|
133
125
|
lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));
|
|
134
126
|
}
|
|
135
127
|
p.x = lon;
|
|
136
128
|
p.y = lat;
|
|
137
129
|
return p;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
130
|
+
} else {
|
|
140
131
|
if (Math.abs(this.coslat0) <= EPSLN) {
|
|
141
132
|
if (rh <= EPSLN) {
|
|
142
133
|
lat = this.lat0;
|
|
143
134
|
lon = this.long0;
|
|
144
135
|
p.x = lon;
|
|
145
136
|
p.y = lat;
|
|
146
|
-
//trace(p.toString());
|
|
137
|
+
// trace(p.toString());
|
|
147
138
|
return p;
|
|
148
139
|
}
|
|
149
140
|
p.x *= this.con;
|
|
150
141
|
p.y *= this.con;
|
|
151
142
|
ts = rh * this.cons / (2 * this.a * this.k0);
|
|
152
143
|
lat = this.con * phi2z(this.e, ts);
|
|
153
|
-
lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, -
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
144
|
+
lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, -1 * p.y));
|
|
145
|
+
} else {
|
|
156
146
|
ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
|
|
157
147
|
lon = this.long0;
|
|
158
148
|
if (rh <= EPSLN) {
|
|
159
149
|
Chi = this.X0;
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
150
|
+
} else {
|
|
162
151
|
Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
|
|
163
152
|
lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));
|
|
164
153
|
}
|
|
@@ -168,12 +157,11 @@ export function inverse(p) {
|
|
|
168
157
|
p.x = lon;
|
|
169
158
|
p.y = lat;
|
|
170
159
|
|
|
171
|
-
//trace(p.toString());
|
|
160
|
+
// trace(p.toString());
|
|
172
161
|
return p;
|
|
173
|
-
|
|
174
162
|
}
|
|
175
163
|
|
|
176
|
-
export var names = [
|
|
164
|
+
export var names = ['stere', 'Stereographic_South_Pole', 'Polar_Stereographic_variant_A', 'Polar_Stereographic_variant_B', 'Polar_Stereographic'];
|
|
177
165
|
export default {
|
|
178
166
|
init: init,
|
|
179
167
|
forward: forward,
|
|
@@ -11,7 +11,7 @@ export function init() {
|
|
|
11
11
|
this.cosc0 = Math.cos(this.phic0);
|
|
12
12
|
this.R2 = 2 * this.rc;
|
|
13
13
|
if (!this.title) {
|
|
14
|
-
this.title =
|
|
14
|
+
this.title = 'Oblique Stereographic Alternative';
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -43,8 +43,7 @@ export function inverse(p) {
|
|
|
43
43
|
cosc = Math.cos(c);
|
|
44
44
|
lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
|
|
45
45
|
lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
46
|
+
} else {
|
|
48
47
|
lat = this.phic0;
|
|
49
48
|
lon = 0;
|
|
50
49
|
}
|
|
@@ -56,7 +55,7 @@ export function inverse(p) {
|
|
|
56
55
|
return p;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
export var names = [
|
|
58
|
+
export var names = ['Stereographic_North_Pole', 'Oblique_Stereographic', 'sterea', 'Oblique Stereographic Alternative', 'Double_Stereographic'];
|
|
60
59
|
export default {
|
|
61
60
|
init: init,
|
|
62
61
|
forward: forward,
|