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/eqc.js
CHANGED
|
@@ -2,13 +2,12 @@ import adjust_lon from '../common/adjust_lon';
|
|
|
2
2
|
import adjust_lat from '../common/adjust_lat';
|
|
3
3
|
|
|
4
4
|
export function init() {
|
|
5
|
-
|
|
6
5
|
this.x0 = this.x0 || 0;
|
|
7
6
|
this.y0 = this.y0 || 0;
|
|
8
7
|
this.lat0 = this.lat0 || 0;
|
|
9
8
|
this.long0 = this.long0 || 0;
|
|
10
9
|
this.lat_ts = this.lat_ts || 0;
|
|
11
|
-
this.title = this.title ||
|
|
10
|
+
this.title = this.title || 'Equidistant Cylindrical (Plate Carre)';
|
|
12
11
|
|
|
13
12
|
this.rc = Math.cos(this.lat_ts);
|
|
14
13
|
}
|
|
@@ -16,7 +15,6 @@ export function init() {
|
|
|
16
15
|
// forward equations--mapping lat,long to x,y
|
|
17
16
|
// -----------------------------------------------------------------
|
|
18
17
|
export function forward(p) {
|
|
19
|
-
|
|
20
18
|
var lon = p.x;
|
|
21
19
|
var lat = p.y;
|
|
22
20
|
|
|
@@ -30,7 +28,6 @@ export function forward(p) {
|
|
|
30
28
|
// inverse equations--mapping x,y to lat/long
|
|
31
29
|
// -----------------------------------------------------------------
|
|
32
30
|
export function inverse(p) {
|
|
33
|
-
|
|
34
31
|
var x = p.x;
|
|
35
32
|
var y = p.y;
|
|
36
33
|
|
|
@@ -39,7 +36,7 @@ export function inverse(p) {
|
|
|
39
36
|
return p;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
export var names = [
|
|
39
|
+
export var names = ['Equirectangular', 'Equidistant_Cylindrical', 'Equidistant_Cylindrical_Spherical', 'eqc'];
|
|
43
40
|
export default {
|
|
44
41
|
init: init,
|
|
45
42
|
forward: forward,
|
package/lib/projections/eqdc.js
CHANGED
|
@@ -7,12 +7,11 @@ import mlfn from '../common/mlfn';
|
|
|
7
7
|
import adjust_lon from '../common/adjust_lon';
|
|
8
8
|
import adjust_lat from '../common/adjust_lat';
|
|
9
9
|
import imlfn from '../common/imlfn';
|
|
10
|
-
import {EPSLN} from '../constants/values';
|
|
10
|
+
import { EPSLN } from '../constants/values';
|
|
11
11
|
|
|
12
12
|
export function init() {
|
|
13
|
-
|
|
14
13
|
/* Place parameters in static storage for common use
|
|
15
|
-
|
|
14
|
+
------------------------------------------------- */
|
|
16
15
|
// Standard Parallels cannot be equal and on opposite sides of the equator
|
|
17
16
|
if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
|
|
18
17
|
return;
|
|
@@ -34,8 +33,7 @@ export function init() {
|
|
|
34
33
|
|
|
35
34
|
if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
|
|
36
35
|
this.ns = this.sinphi;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
36
|
+
} else {
|
|
39
37
|
this.sinphi = Math.sin(this.lat2);
|
|
40
38
|
this.cosphi = Math.cos(this.lat2);
|
|
41
39
|
this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
|
|
@@ -48,18 +46,17 @@ export function init() {
|
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
/* Equidistant Conic forward equations--mapping lat,long to x,y
|
|
51
|
-
|
|
49
|
+
----------------------------------------------------------- */
|
|
52
50
|
export function forward(p) {
|
|
53
51
|
var lon = p.x;
|
|
54
52
|
var lat = p.y;
|
|
55
53
|
var rh1;
|
|
56
54
|
|
|
57
55
|
/* Forward equations
|
|
58
|
-
|
|
56
|
+
----------------- */
|
|
59
57
|
if (this.sphere) {
|
|
60
58
|
rh1 = this.a * (this.g - lat);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
59
|
+
} else {
|
|
63
60
|
var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
|
|
64
61
|
rh1 = this.a * (this.g - ml);
|
|
65
62
|
}
|
|
@@ -72,7 +69,7 @@ export function forward(p) {
|
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
/* Inverse equations
|
|
75
|
-
|
|
72
|
+
----------------- */
|
|
76
73
|
export function inverse(p) {
|
|
77
74
|
p.x -= this.x0;
|
|
78
75
|
p.y = this.rh - p.y + this.y0;
|
|
@@ -80,8 +77,7 @@ export function inverse(p) {
|
|
|
80
77
|
if (this.ns >= 0) {
|
|
81
78
|
rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
|
|
82
79
|
con = 1;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
80
|
+
} else {
|
|
85
81
|
rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
|
|
86
82
|
con = -1;
|
|
87
83
|
}
|
|
@@ -96,8 +92,7 @@ export function inverse(p) {
|
|
|
96
92
|
p.x = lon;
|
|
97
93
|
p.y = lat;
|
|
98
94
|
return p;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
95
|
+
} else {
|
|
101
96
|
var ml = this.g - rh1 / this.a;
|
|
102
97
|
lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
|
|
103
98
|
lon = adjust_lon(this.long0 + theta / this.ns);
|
|
@@ -105,10 +100,9 @@ export function inverse(p) {
|
|
|
105
100
|
p.y = lat;
|
|
106
101
|
return p;
|
|
107
102
|
}
|
|
108
|
-
|
|
109
103
|
}
|
|
110
104
|
|
|
111
|
-
export var names = [
|
|
105
|
+
export var names = ['Equidistant_Conic', 'eqdc'];
|
|
112
106
|
export default {
|
|
113
107
|
init: init,
|
|
114
108
|
forward: forward,
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
* Modified for proj4js by Andreas Hocevar by Andreas Hocevar March 2024
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
import adjust_lon from
|
|
30
|
+
import adjust_lon from '../common/adjust_lon';
|
|
31
31
|
|
|
32
32
|
var A1 = 1.340264,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
A2 = -0.081106,
|
|
34
|
+
A3 = 0.000893,
|
|
35
|
+
A4 = 0.003796,
|
|
36
|
+
M = Math.sqrt(3) / 2.0;
|
|
37
37
|
|
|
38
38
|
export function init() {
|
|
39
39
|
this.es = 0;
|
|
@@ -44,10 +44,10 @@ export function forward(p) {
|
|
|
44
44
|
var lam = adjust_lon(p.x - this.long0);
|
|
45
45
|
var phi = p.y;
|
|
46
46
|
var paramLat = Math.asin(M * Math.sin(phi)),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
p.x = lam * Math.cos(paramLat)
|
|
50
|
-
|
|
47
|
+
paramLatSq = paramLat * paramLat,
|
|
48
|
+
paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;
|
|
49
|
+
p.x = lam * Math.cos(paramLat)
|
|
50
|
+
/ (M * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)));
|
|
51
51
|
p.y = paramLat * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq));
|
|
52
52
|
|
|
53
53
|
p.x = this.a * p.x + this.x0;
|
|
@@ -60,9 +60,9 @@ export function inverse(p) {
|
|
|
60
60
|
p.y = (p.y - this.y0) / this.a;
|
|
61
61
|
|
|
62
62
|
var EPS = 1e-9,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
NITER = 12,
|
|
64
|
+
paramLat = p.y,
|
|
65
|
+
paramLatSq, paramLatPow6, fy, fpy, dlat, i;
|
|
66
66
|
|
|
67
67
|
for (i = 0; i < NITER; ++i) {
|
|
68
68
|
paramLatSq = paramLat * paramLat;
|
|
@@ -71,23 +71,23 @@ export function inverse(p) {
|
|
|
71
71
|
fpy = A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq);
|
|
72
72
|
paramLat -= dlat = fy / fpy;
|
|
73
73
|
if (Math.abs(dlat) < EPS) {
|
|
74
|
-
|
|
74
|
+
break;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
paramLatSq = paramLat * paramLat;
|
|
78
78
|
paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;
|
|
79
|
-
p.x = M * p.x * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq))
|
|
80
|
-
|
|
79
|
+
p.x = M * p.x * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq))
|
|
80
|
+
/ Math.cos(paramLat);
|
|
81
81
|
p.y = Math.asin(Math.sin(paramLat) / M);
|
|
82
82
|
|
|
83
83
|
p.x = adjust_lon(p.x + this.long0);
|
|
84
84
|
return p;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
export var names = [
|
|
87
|
+
export var names = ['eqearth', 'Equal Earth', 'Equal_Earth'];
|
|
88
88
|
export default {
|
|
89
89
|
init: init,
|
|
90
90
|
forward: forward,
|
|
91
91
|
inverse: inverse,
|
|
92
92
|
names: names
|
|
93
|
-
};
|
|
93
|
+
};
|
package/lib/projections/equi.js
CHANGED
|
@@ -5,13 +5,12 @@ export function init() {
|
|
|
5
5
|
this.y0 = this.y0 || 0;
|
|
6
6
|
this.lat0 = this.lat0 || 0;
|
|
7
7
|
this.long0 = this.long0 || 0;
|
|
8
|
-
///this.t2;
|
|
8
|
+
/// this.t2;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/* Equirectangular forward equations--mapping lat,long to x,y
|
|
12
|
-
|
|
12
|
+
--------------------------------------------------------- */
|
|
13
13
|
export function forward(p) {
|
|
14
|
-
|
|
15
14
|
var lon = p.x;
|
|
16
15
|
var lat = p.y;
|
|
17
16
|
|
|
@@ -27,9 +26,8 @@ export function forward(p) {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
/* Equirectangular inverse equations--mapping x,y to lat/long
|
|
30
|
-
|
|
29
|
+
--------------------------------------------------------- */
|
|
31
30
|
export function inverse(p) {
|
|
32
|
-
|
|
33
31
|
p.x -= this.x0;
|
|
34
32
|
p.y -= this.y0;
|
|
35
33
|
var lat = p.y / this.a;
|
|
@@ -39,7 +37,7 @@ export function inverse(p) {
|
|
|
39
37
|
p.y = lat;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
export var names = [
|
|
40
|
+
export var names = ['equi'];
|
|
43
41
|
export default {
|
|
44
42
|
init: init,
|
|
45
43
|
forward: forward,
|
|
@@ -35,12 +35,12 @@ export function init() {
|
|
|
35
35
|
var n = f / (2 - f);
|
|
36
36
|
var np = n;
|
|
37
37
|
|
|
38
|
-
this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675
|
|
39
|
-
this.cbg[0] = n * (-2 + n * (
|
|
38
|
+
this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675))))));
|
|
39
|
+
this.cbg[0] = n * (-2 + n * (2 / 3 + n * (4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
|
|
40
40
|
|
|
41
41
|
np = np * n;
|
|
42
42
|
this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
|
|
43
|
-
this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * (
|
|
43
|
+
this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * (-13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
|
|
44
44
|
|
|
45
45
|
np = np * n;
|
|
46
46
|
this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
|
|
@@ -48,7 +48,7 @@ export function init() {
|
|
|
48
48
|
|
|
49
49
|
np = np * n;
|
|
50
50
|
this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
|
|
51
|
-
this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * (
|
|
51
|
+
this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * (-24832 / 14175)));
|
|
52
52
|
|
|
53
53
|
np = np * n;
|
|
54
54
|
this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
|
|
@@ -61,14 +61,14 @@ export function init() {
|
|
|
61
61
|
np = Math.pow(n, 2);
|
|
62
62
|
this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
|
|
63
63
|
|
|
64
|
-
this.utg[0] = n * (-0.5 + n * (
|
|
64
|
+
this.utg[0] = n * (-0.5 + n * (2 / 3 + n * (-37 / 96 + n * (1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
|
|
65
65
|
this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
|
|
66
66
|
|
|
67
67
|
this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
|
|
68
68
|
this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
|
|
69
69
|
|
|
70
70
|
np = np * n;
|
|
71
|
-
this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720
|
|
71
|
+
this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720))));
|
|
72
72
|
this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
|
|
73
73
|
|
|
74
74
|
np = np * n;
|
|
@@ -112,8 +112,7 @@ export function forward(p) {
|
|
|
112
112
|
if (Math.abs(Ce) <= 2.623395162778) {
|
|
113
113
|
x = this.a * (this.Qn * Ce) + this.x0;
|
|
114
114
|
y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
115
|
+
} else {
|
|
117
116
|
x = Infinity;
|
|
118
117
|
y = Infinity;
|
|
119
118
|
}
|
|
@@ -151,8 +150,7 @@ export function inverse(p) {
|
|
|
151
150
|
|
|
152
151
|
lon = adjust_lon(Ce + this.long0);
|
|
153
152
|
lat = gatg(this.cgb, Cn);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
153
|
+
} else {
|
|
156
154
|
lon = Infinity;
|
|
157
155
|
lat = Infinity;
|
|
158
156
|
}
|
|
@@ -163,7 +161,7 @@ export function inverse(p) {
|
|
|
163
161
|
return p;
|
|
164
162
|
}
|
|
165
163
|
|
|
166
|
-
export var names = [
|
|
164
|
+
export var names = ['Extended_Transverse_Mercator', 'Extended Transverse Mercator', 'etmerc', 'Transverse_Mercator', 'Transverse Mercator', 'Gauss Kruger', 'Gauss_Kruger', 'tmerc'];
|
|
167
165
|
export default {
|
|
168
166
|
init: init,
|
|
169
167
|
forward: forward,
|
package/lib/projections/gauss.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import srat from '../common/srat';
|
|
2
2
|
var MAX_ITER = 20;
|
|
3
|
-
import {HALF_PI, FORTPI} from '../constants/values';
|
|
3
|
+
import { HALF_PI, FORTPI } from '../constants/values';
|
|
4
4
|
|
|
5
5
|
export function init() {
|
|
6
6
|
var sphi = Math.sin(this.lat0);
|
|
@@ -28,7 +28,7 @@ export function inverse(p) {
|
|
|
28
28
|
var lat = p.y;
|
|
29
29
|
var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
|
|
30
30
|
for (var i = MAX_ITER; i > 0; --i) {
|
|
31
|
-
lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), -
|
|
31
|
+
lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), -0.5 * this.e)) - HALF_PI;
|
|
32
32
|
if (Math.abs(lat - p.y) < DEL_TOL) {
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
@@ -43,7 +43,7 @@ export function inverse(p) {
|
|
|
43
43
|
return p;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export var names = [
|
|
46
|
+
export var names = ['gauss'];
|
|
47
47
|
export default {
|
|
48
48
|
init: init,
|
|
49
49
|
forward: forward,
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
geodeticToGeocentric,
|
|
3
|
+
geocentricToGeodetic
|
|
4
4
|
} from '../datumUtils';
|
|
5
5
|
|
|
6
6
|
export function init() {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
this.name = 'geocent';
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
export function forward(p) {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var point = geodeticToGeocentric(p, this.es, this.a);
|
|
12
|
+
return point;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export function inverse(p) {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
var point = geocentricToGeodetic(p, this.es, this.a, this.b);
|
|
17
|
+
return point;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
export var names = [
|
|
20
|
+
export var names = ['Geocentric', 'geocentric', 'geocent', 'Geocent'];
|
|
22
21
|
export default {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
22
|
+
init: init,
|
|
23
|
+
forward: forward,
|
|
24
|
+
inverse: inverse,
|
|
25
|
+
names: names
|
|
26
|
+
};
|
package/lib/projections/geos.js
CHANGED
|
@@ -1,159 +1,158 @@
|
|
|
1
1
|
import hypot from '../common/hypot';
|
|
2
2
|
|
|
3
3
|
export function init() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
this.flip_axis = (this.sweep === 'x' ? 1 : 0);
|
|
5
|
+
this.h = Number(this.h);
|
|
6
|
+
this.radius_g_1 = this.h / this.a;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
if (this.radius_g_1 <= 0 || this.radius_g_1 > 1e10) {
|
|
9
|
+
throw new Error();
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
this.radius_g = 1.0 + this.radius_g_1;
|
|
13
|
+
this.C = this.radius_g * this.radius_g - 1.0;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (this.es !== 0.0) {
|
|
16
|
+
var one_es = 1.0 - this.es;
|
|
17
|
+
var rone_es = 1 / one_es;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
this.radius_p = Math.sqrt(one_es);
|
|
20
|
+
this.radius_p2 = one_es;
|
|
21
|
+
this.radius_p_inv2 = rone_es;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
this.shape = 'ellipse'; // Use as a condition in the forward and inverse functions.
|
|
24
|
+
} else {
|
|
25
|
+
this.radius_p = 1.0;
|
|
26
|
+
this.radius_p2 = 1.0;
|
|
27
|
+
this.radius_p_inv2 = 1.0;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
this.shape = 'sphere'; // Use as a condition in the forward and inverse functions.
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (!this.title) {
|
|
33
|
+
this.title = 'Geostationary Satellite View';
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function forward(p) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
tmp = this.radius_g - v_x;
|
|
58
|
-
if (this.flip_axis) {
|
|
59
|
-
p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
|
|
60
|
-
p.y = this.radius_g_1 * Math.atan(v_z / tmp);
|
|
61
|
-
} else {
|
|
62
|
-
p.x = this.radius_g_1 * Math.atan(v_y / tmp);
|
|
63
|
-
p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
|
|
64
|
-
}
|
|
65
|
-
} else if (this.shape === 'sphere') {
|
|
66
|
-
tmp = Math.cos(lat);
|
|
67
|
-
v_x = Math.cos(lon) * tmp;
|
|
68
|
-
v_y = Math.sin(lon) * tmp;
|
|
69
|
-
v_z = Math.sin(lat);
|
|
70
|
-
tmp = this.radius_g - v_x;
|
|
71
|
-
|
|
72
|
-
if (this.flip_axis) {
|
|
73
|
-
p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
|
|
74
|
-
p.y = this.radius_g_1 * Math.atan(v_z / tmp);
|
|
75
|
-
} else {
|
|
76
|
-
p.x = this.radius_g_1 * Math.atan(v_y / tmp);
|
|
77
|
-
p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
|
|
78
|
-
}
|
|
38
|
+
var lon = p.x;
|
|
39
|
+
var lat = p.y;
|
|
40
|
+
var tmp, v_x, v_y, v_z;
|
|
41
|
+
lon = lon - this.long0;
|
|
42
|
+
|
|
43
|
+
if (this.shape === 'ellipse') {
|
|
44
|
+
lat = Math.atan(this.radius_p2 * Math.tan(lat));
|
|
45
|
+
var r = this.radius_p / hypot(this.radius_p * Math.cos(lat), Math.sin(lat));
|
|
46
|
+
|
|
47
|
+
v_x = r * Math.cos(lon) * Math.cos(lat);
|
|
48
|
+
v_y = r * Math.sin(lon) * Math.cos(lat);
|
|
49
|
+
v_z = r * Math.sin(lat);
|
|
50
|
+
|
|
51
|
+
if (((this.radius_g - v_x) * v_x - v_y * v_y - v_z * v_z * this.radius_p_inv2) < 0.0) {
|
|
52
|
+
p.x = Number.NaN;
|
|
53
|
+
p.y = Number.NaN;
|
|
54
|
+
return p;
|
|
79
55
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
56
|
+
|
|
57
|
+
tmp = this.radius_g - v_x;
|
|
58
|
+
if (this.flip_axis) {
|
|
59
|
+
p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
|
|
60
|
+
p.y = this.radius_g_1 * Math.atan(v_z / tmp);
|
|
61
|
+
} else {
|
|
62
|
+
p.x = this.radius_g_1 * Math.atan(v_y / tmp);
|
|
63
|
+
p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
|
|
64
|
+
}
|
|
65
|
+
} else if (this.shape === 'sphere') {
|
|
66
|
+
tmp = Math.cos(lat);
|
|
67
|
+
v_x = Math.cos(lon) * tmp;
|
|
68
|
+
v_y = Math.sin(lon) * tmp;
|
|
69
|
+
v_z = Math.sin(lat);
|
|
70
|
+
tmp = this.radius_g - v_x;
|
|
71
|
+
|
|
72
|
+
if (this.flip_axis) {
|
|
73
|
+
p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));
|
|
74
|
+
p.y = this.radius_g_1 * Math.atan(v_z / tmp);
|
|
75
|
+
} else {
|
|
76
|
+
p.x = this.radius_g_1 * Math.atan(v_y / tmp);
|
|
77
|
+
p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
p.x = p.x * this.a;
|
|
81
|
+
p.y = p.y * this.a;
|
|
82
|
+
return p;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function inverse(p) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
var v_zp = v_z / this.radius_p;
|
|
104
|
-
a = v_y * v_y + v_zp * v_zp + v_x * v_x;
|
|
105
|
-
b = 2 * this.radius_g * v_x;
|
|
106
|
-
det = (b * b) - 4 * a * this.C;
|
|
107
|
-
|
|
108
|
-
if (det < 0.0) {
|
|
109
|
-
p.x = Number.NaN;
|
|
110
|
-
p.y = Number.NaN;
|
|
111
|
-
return p;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
k = (-b - Math.sqrt(det)) / (2.0 * a);
|
|
115
|
-
v_x = this.radius_g + k * v_x;
|
|
116
|
-
v_y *= k;
|
|
117
|
-
v_z *= k;
|
|
118
|
-
|
|
119
|
-
p.x = Math.atan2(v_y, v_x);
|
|
120
|
-
p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
|
|
121
|
-
p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));
|
|
122
|
-
} else if (this.shape === 'sphere') {
|
|
123
|
-
if (this.flip_axis) {
|
|
124
|
-
v_z = Math.tan(p.y / this.radius_g_1);
|
|
125
|
-
v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1.0 + v_z * v_z);
|
|
126
|
-
} else {
|
|
127
|
-
v_y = Math.tan(p.x / this.radius_g_1);
|
|
128
|
-
v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1.0 + v_y * v_y);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
a = v_y * v_y + v_z * v_z + v_x * v_x;
|
|
132
|
-
b = 2 * this.radius_g * v_x;
|
|
133
|
-
det = (b * b) - 4 * a * this.C;
|
|
134
|
-
if (det < 0.0) {
|
|
135
|
-
p.x = Number.NaN;
|
|
136
|
-
p.y = Number.NaN;
|
|
137
|
-
return p;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
k = (-b - Math.sqrt(det)) / (2.0 * a);
|
|
141
|
-
v_x = this.radius_g + k * v_x;
|
|
142
|
-
v_y *= k;
|
|
143
|
-
v_z *= k;
|
|
144
|
-
|
|
145
|
-
p.x = Math.atan2(v_y, v_x);
|
|
146
|
-
p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
|
|
86
|
+
var v_x = -1.0;
|
|
87
|
+
var v_y = 0.0;
|
|
88
|
+
var v_z = 0.0;
|
|
89
|
+
var a, b, det, k;
|
|
90
|
+
|
|
91
|
+
p.x = p.x / this.a;
|
|
92
|
+
p.y = p.y / this.a;
|
|
93
|
+
|
|
94
|
+
if (this.shape === 'ellipse') {
|
|
95
|
+
if (this.flip_axis) {
|
|
96
|
+
v_z = Math.tan(p.y / this.radius_g_1);
|
|
97
|
+
v_y = Math.tan(p.x / this.radius_g_1) * hypot(1.0, v_z);
|
|
98
|
+
} else {
|
|
99
|
+
v_y = Math.tan(p.x / this.radius_g_1);
|
|
100
|
+
v_z = Math.tan(p.y / this.radius_g_1) * hypot(1.0, v_y);
|
|
147
101
|
}
|
|
148
|
-
|
|
149
|
-
|
|
102
|
+
|
|
103
|
+
var v_zp = v_z / this.radius_p;
|
|
104
|
+
a = v_y * v_y + v_zp * v_zp + v_x * v_x;
|
|
105
|
+
b = 2 * this.radius_g * v_x;
|
|
106
|
+
det = (b * b) - 4 * a * this.C;
|
|
107
|
+
|
|
108
|
+
if (det < 0.0) {
|
|
109
|
+
p.x = Number.NaN;
|
|
110
|
+
p.y = Number.NaN;
|
|
111
|
+
return p;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
k = (-b - Math.sqrt(det)) / (2.0 * a);
|
|
115
|
+
v_x = this.radius_g + k * v_x;
|
|
116
|
+
v_y *= k;
|
|
117
|
+
v_z *= k;
|
|
118
|
+
|
|
119
|
+
p.x = Math.atan2(v_y, v_x);
|
|
120
|
+
p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
|
|
121
|
+
p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));
|
|
122
|
+
} else if (this.shape === 'sphere') {
|
|
123
|
+
if (this.flip_axis) {
|
|
124
|
+
v_z = Math.tan(p.y / this.radius_g_1);
|
|
125
|
+
v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1.0 + v_z * v_z);
|
|
126
|
+
} else {
|
|
127
|
+
v_y = Math.tan(p.x / this.radius_g_1);
|
|
128
|
+
v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1.0 + v_y * v_y);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
a = v_y * v_y + v_z * v_z + v_x * v_x;
|
|
132
|
+
b = 2 * this.radius_g * v_x;
|
|
133
|
+
det = (b * b) - 4 * a * this.C;
|
|
134
|
+
if (det < 0.0) {
|
|
135
|
+
p.x = Number.NaN;
|
|
136
|
+
p.y = Number.NaN;
|
|
137
|
+
return p;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
k = (-b - Math.sqrt(det)) / (2.0 * a);
|
|
141
|
+
v_x = this.radius_g + k * v_x;
|
|
142
|
+
v_y *= k;
|
|
143
|
+
v_z *= k;
|
|
144
|
+
|
|
145
|
+
p.x = Math.atan2(v_y, v_x);
|
|
146
|
+
p.y = Math.atan(v_z * Math.cos(p.x) / v_x);
|
|
147
|
+
}
|
|
148
|
+
p.x = p.x + this.long0;
|
|
149
|
+
return p;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
export var names = [
|
|
152
|
+
export var names = ['Geostationary Satellite View', 'Geostationary_Satellite', 'geos'];
|
|
153
153
|
export default {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
init: init,
|
|
155
|
+
forward: forward,
|
|
156
|
+
inverse: inverse,
|
|
157
|
+
names: names
|
|
158
158
|
};
|
|
159
|
-
|