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/gnom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import adjust_lon from '../common/adjust_lon';
|
|
2
2
|
import asinz from '../common/asinz';
|
|
3
|
-
import {EPSLN} from '../constants/values';
|
|
3
|
+
import { EPSLN } from '../constants/values';
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
reference:
|
|
@@ -9,9 +9,8 @@ import {EPSLN} from '../constants/values';
|
|
|
9
9
|
Accessed: 12th November 2009
|
|
10
10
|
*/
|
|
11
11
|
export function init() {
|
|
12
|
-
|
|
13
12
|
/* Place parameters in static storage for common use
|
|
14
|
-
|
|
13
|
+
------------------------------------------------- */
|
|
15
14
|
this.sin_p14 = Math.sin(this.lat0);
|
|
16
15
|
this.cos_p14 = Math.cos(this.lat0);
|
|
17
16
|
// Approximation for projecting points to the horizon (infinity)
|
|
@@ -20,7 +19,7 @@ export function init() {
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
/* Gnomonic forward equations--mapping lat,long to x,y
|
|
23
|
-
|
|
22
|
+
--------------------------------------------------- */
|
|
24
23
|
export function forward(p) {
|
|
25
24
|
var sinphi, cosphi; /* sin and cos value */
|
|
26
25
|
var dlon; /* delta longitude value */
|
|
@@ -31,7 +30,7 @@ export function forward(p) {
|
|
|
31
30
|
var lon = p.x;
|
|
32
31
|
var lat = p.y;
|
|
33
32
|
/* Forward equations
|
|
34
|
-
|
|
33
|
+
----------------- */
|
|
35
34
|
dlon = adjust_lon(lon - this.long0);
|
|
36
35
|
|
|
37
36
|
sinphi = Math.sin(lat);
|
|
@@ -43,9 +42,7 @@ export function forward(p) {
|
|
|
43
42
|
if ((g > 0) || (Math.abs(g) <= EPSLN)) {
|
|
44
43
|
x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
|
|
45
44
|
y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
|
|
45
|
+
} else {
|
|
49
46
|
// Point is in the opposing hemisphere and is unprojectable
|
|
50
47
|
// We still need to return a reasonable point, so we project
|
|
51
48
|
// to infinity, on a bearing
|
|
@@ -55,7 +52,6 @@ export function forward(p) {
|
|
|
55
52
|
|
|
56
53
|
x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
|
|
57
54
|
y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
|
|
58
|
-
|
|
59
55
|
}
|
|
60
56
|
p.x = x;
|
|
61
57
|
p.y = y;
|
|
@@ -69,7 +65,7 @@ export function inverse(p) {
|
|
|
69
65
|
var lon, lat;
|
|
70
66
|
|
|
71
67
|
/* Inverse equations
|
|
72
|
-
|
|
68
|
+
----------------- */
|
|
73
69
|
p.x = (p.x - this.x0) / this.a;
|
|
74
70
|
p.y = (p.y - this.y0) / this.a;
|
|
75
71
|
|
|
@@ -84,8 +80,7 @@ export function inverse(p) {
|
|
|
84
80
|
lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
|
|
85
81
|
lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
|
|
86
82
|
lon = adjust_lon(this.long0 + lon);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
83
|
+
} else {
|
|
89
84
|
lat = this.phic0;
|
|
90
85
|
lon = 0;
|
|
91
86
|
}
|
|
@@ -95,7 +90,7 @@ export function inverse(p) {
|
|
|
95
90
|
return p;
|
|
96
91
|
}
|
|
97
92
|
|
|
98
|
-
export var names = [
|
|
93
|
+
export var names = ['gnom'];
|
|
99
94
|
export default {
|
|
100
95
|
init: init,
|
|
101
96
|
forward: forward,
|
|
@@ -4,7 +4,6 @@ import cosh from '../common/cosh';
|
|
|
4
4
|
import invlatiso from '../common/invlatiso';
|
|
5
5
|
|
|
6
6
|
export function init() {
|
|
7
|
-
|
|
8
7
|
// array of: a, b, lon0, lat0, k0, x0, y0
|
|
9
8
|
var temp = this.b / this.a;
|
|
10
9
|
this.e = Math.sqrt(1 - temp * temp);
|
|
@@ -19,14 +18,13 @@ export function init() {
|
|
|
19
18
|
this.ys = this.y0 - this.n2 * pc;
|
|
20
19
|
|
|
21
20
|
if (!this.title) {
|
|
22
|
-
this.title =
|
|
21
|
+
this.title = 'Gauss Schreiber transverse mercator';
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
// forward equations--mapping lat,long to x,y
|
|
27
26
|
// -----------------------------------------------------------------
|
|
28
27
|
export function forward(p) {
|
|
29
|
-
|
|
30
28
|
var lon = p.x;
|
|
31
29
|
var lat = p.y;
|
|
32
30
|
|
|
@@ -42,7 +40,6 @@ export function forward(p) {
|
|
|
42
40
|
// inverse equations--mapping x,y to lat/long
|
|
43
41
|
// -----------------------------------------------------------------
|
|
44
42
|
export function inverse(p) {
|
|
45
|
-
|
|
46
43
|
var x = p.x;
|
|
47
44
|
var y = p.y;
|
|
48
45
|
|
|
@@ -54,7 +51,7 @@ export function inverse(p) {
|
|
|
54
51
|
return p;
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
export var names = [
|
|
54
|
+
export var names = ['gstmerg', 'gstmerc'];
|
|
58
55
|
export default {
|
|
59
56
|
init: init,
|
|
60
57
|
forward: forward,
|
|
@@ -64,7 +64,7 @@ export function inverse(p) {
|
|
|
64
64
|
var ok;
|
|
65
65
|
|
|
66
66
|
/* Transformation */
|
|
67
|
-
/* revert y, x*/
|
|
67
|
+
/* revert y, x */
|
|
68
68
|
var tmp = p.x;
|
|
69
69
|
p.x = p.y;
|
|
70
70
|
p.y = tmp;
|
|
@@ -83,7 +83,7 @@ export function inverse(p) {
|
|
|
83
83
|
ok = 0;
|
|
84
84
|
var iter = 0;
|
|
85
85
|
do {
|
|
86
|
-
p.y = 2 * (Math.atan(Math.pow(this.k, -
|
|
86
|
+
p.y = 2 * (Math.atan(Math.pow(this.k, -1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);
|
|
87
87
|
if (Math.abs(fi1 - p.y) < 0.0000000001) {
|
|
88
88
|
ok = 1;
|
|
89
89
|
}
|
|
@@ -97,7 +97,7 @@ export function inverse(p) {
|
|
|
97
97
|
return (p);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
export var names = [
|
|
100
|
+
export var names = ['Krovak', 'krovak'];
|
|
101
101
|
export default {
|
|
102
102
|
init: init,
|
|
103
103
|
forward: forward,
|
package/lib/projections/laea.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {HALF_PI, EPSLN, FORTPI} from '../constants/values';
|
|
1
|
+
import { HALF_PI, EPSLN, FORTPI } from '../constants/values';
|
|
3
2
|
|
|
4
3
|
import qsfnz from '../common/qsfnz';
|
|
5
4
|
import adjust_lon from '../common/adjust_lon';
|
|
@@ -17,16 +16,14 @@ export var EQUIT = 3;
|
|
|
17
16
|
export var OBLIQ = 4;
|
|
18
17
|
|
|
19
18
|
/* Initialize the Lambert Azimuthal Equal Area projection
|
|
20
|
-
|
|
19
|
+
------------------------------------------------------ */
|
|
21
20
|
export function init() {
|
|
22
21
|
var t = Math.abs(this.lat0);
|
|
23
22
|
if (Math.abs(t - HALF_PI) < EPSLN) {
|
|
24
23
|
this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
|
|
25
|
-
}
|
|
26
|
-
else if (Math.abs(t) < EPSLN) {
|
|
24
|
+
} else if (Math.abs(t) < EPSLN) {
|
|
27
25
|
this.mode = this.EQUIT;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
26
|
+
} else {
|
|
30
27
|
this.mode = this.OBLIQ;
|
|
31
28
|
}
|
|
32
29
|
if (this.es > 0) {
|
|
@@ -36,30 +33,29 @@ export function init() {
|
|
|
36
33
|
this.mmf = 0.5 / (1 - this.es);
|
|
37
34
|
this.apa = authset(this.es);
|
|
38
35
|
switch (this.mode) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
case this.N_POLE:
|
|
37
|
+
this.dd = 1;
|
|
38
|
+
break;
|
|
39
|
+
case this.S_POLE:
|
|
40
|
+
this.dd = 1;
|
|
41
|
+
break;
|
|
42
|
+
case this.EQUIT:
|
|
43
|
+
this.rq = Math.sqrt(0.5 * this.qp);
|
|
44
|
+
this.dd = 1 / this.rq;
|
|
45
|
+
this.xmf = 1;
|
|
46
|
+
this.ymf = 0.5 * this.qp;
|
|
47
|
+
break;
|
|
48
|
+
case this.OBLIQ:
|
|
49
|
+
this.rq = Math.sqrt(0.5 * this.qp);
|
|
50
|
+
sinphi = Math.sin(this.lat0);
|
|
51
|
+
this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
|
|
52
|
+
this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
|
|
53
|
+
this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
|
|
54
|
+
this.ymf = (this.xmf = this.rq) / this.dd;
|
|
55
|
+
this.xmf *= this.dd;
|
|
56
|
+
break;
|
|
60
57
|
}
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
58
|
+
} else {
|
|
63
59
|
if (this.mode === this.OBLIQ) {
|
|
64
60
|
this.sinph0 = Math.sin(this.lat0);
|
|
65
61
|
this.cosph0 = Math.cos(this.lat0);
|
|
@@ -68,11 +64,10 @@ export function init() {
|
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
/* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
|
|
71
|
-
|
|
67
|
+
----------------------------------------------------------------------- */
|
|
72
68
|
export function forward(p) {
|
|
73
|
-
|
|
74
69
|
/* Forward equations
|
|
75
|
-
|
|
70
|
+
----------------- */
|
|
76
71
|
var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
|
|
77
72
|
var lam = p.x;
|
|
78
73
|
var phi = p.y;
|
|
@@ -90,8 +85,7 @@ export function forward(p) {
|
|
|
90
85
|
y = Math.sqrt(2 / y);
|
|
91
86
|
x = y * cosphi * Math.sin(lam);
|
|
92
87
|
y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
|
|
93
|
-
}
|
|
94
|
-
else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
|
|
88
|
+
} else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
|
|
95
89
|
if (this.mode === this.N_POLE) {
|
|
96
90
|
coslam = -coslam;
|
|
97
91
|
}
|
|
@@ -103,8 +97,7 @@ export function forward(p) {
|
|
|
103
97
|
x = y * Math.sin(lam);
|
|
104
98
|
y *= coslam;
|
|
105
99
|
}
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
100
|
+
} else {
|
|
108
101
|
sinb = 0;
|
|
109
102
|
cosb = 0;
|
|
110
103
|
b = 0;
|
|
@@ -117,46 +110,44 @@ export function forward(p) {
|
|
|
117
110
|
cosb = Math.sqrt(1 - sinb * sinb);
|
|
118
111
|
}
|
|
119
112
|
switch (this.mode) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
113
|
+
case this.OBLIQ:
|
|
114
|
+
b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
|
|
115
|
+
break;
|
|
116
|
+
case this.EQUIT:
|
|
117
|
+
b = 1 + cosb * coslam;
|
|
118
|
+
break;
|
|
119
|
+
case this.N_POLE:
|
|
120
|
+
b = HALF_PI + phi;
|
|
121
|
+
q = this.qp - q;
|
|
122
|
+
break;
|
|
123
|
+
case this.S_POLE:
|
|
124
|
+
b = phi - HALF_PI;
|
|
125
|
+
q = this.qp + q;
|
|
126
|
+
break;
|
|
134
127
|
}
|
|
135
128
|
if (Math.abs(b) < EPSLN) {
|
|
136
129
|
return null;
|
|
137
130
|
}
|
|
138
131
|
switch (this.mode) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
break;
|
|
132
|
+
case this.OBLIQ:
|
|
133
|
+
case this.EQUIT:
|
|
134
|
+
b = Math.sqrt(2 / b);
|
|
135
|
+
if (this.mode === this.OBLIQ) {
|
|
136
|
+
y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
|
|
137
|
+
} else {
|
|
138
|
+
y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
|
|
139
|
+
}
|
|
140
|
+
x = this.xmf * b * cosb * sinlam;
|
|
141
|
+
break;
|
|
142
|
+
case this.N_POLE:
|
|
143
|
+
case this.S_POLE:
|
|
144
|
+
if (q >= 0) {
|
|
145
|
+
x = (b = Math.sqrt(q)) * sinlam;
|
|
146
|
+
y = coslam * ((this.mode === this.S_POLE) ? b : -b);
|
|
147
|
+
} else {
|
|
148
|
+
x = y = 0;
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
160
151
|
}
|
|
161
152
|
}
|
|
162
153
|
|
|
@@ -166,7 +157,7 @@ export function forward(p) {
|
|
|
166
157
|
}
|
|
167
158
|
|
|
168
159
|
/* Inverse equations
|
|
169
|
-
|
|
160
|
+
----------------- */
|
|
170
161
|
export function inverse(p) {
|
|
171
162
|
p.x -= this.x0;
|
|
172
163
|
p.y -= this.y0;
|
|
@@ -188,27 +179,26 @@ export function inverse(p) {
|
|
|
188
179
|
cosz = Math.cos(phi);
|
|
189
180
|
}
|
|
190
181
|
switch (this.mode) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
182
|
+
case this.EQUIT:
|
|
183
|
+
phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);
|
|
184
|
+
x *= sinz;
|
|
185
|
+
y = cosz * rh;
|
|
186
|
+
break;
|
|
187
|
+
case this.OBLIQ:
|
|
188
|
+
phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
|
|
189
|
+
x *= sinz * this.cosph0;
|
|
190
|
+
y = (cosz - Math.sin(phi) * this.sinph0) * rh;
|
|
191
|
+
break;
|
|
192
|
+
case this.N_POLE:
|
|
193
|
+
y = -y;
|
|
194
|
+
phi = HALF_PI - phi;
|
|
195
|
+
break;
|
|
196
|
+
case this.S_POLE:
|
|
197
|
+
phi -= HALF_PI;
|
|
198
|
+
break;
|
|
208
199
|
}
|
|
209
200
|
lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
201
|
+
} else {
|
|
212
202
|
ab = 0;
|
|
213
203
|
if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
|
|
214
204
|
x /= this.dd;
|
|
@@ -226,14 +216,12 @@ export function inverse(p) {
|
|
|
226
216
|
ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
|
|
227
217
|
q = this.qp * ab;
|
|
228
218
|
y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
219
|
+
} else {
|
|
231
220
|
ab = y * sCe / rho;
|
|
232
221
|
q = this.qp * ab;
|
|
233
222
|
y = rho * cCe;
|
|
234
223
|
}
|
|
235
|
-
}
|
|
236
|
-
else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
|
|
224
|
+
} else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
|
|
237
225
|
if (this.mode === this.N_POLE) {
|
|
238
226
|
y = -y;
|
|
239
227
|
}
|
|
@@ -285,7 +273,7 @@ function authlat(beta, APA) {
|
|
|
285
273
|
return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
|
|
286
274
|
}
|
|
287
275
|
|
|
288
|
-
export var names = [
|
|
276
|
+
export var names = ['Lambert Azimuthal Equal Area', 'Lambert_Azimuthal_Equal_Area', 'laea'];
|
|
289
277
|
export default {
|
|
290
278
|
init: init,
|
|
291
279
|
forward: forward,
|
package/lib/projections/lcc.js
CHANGED
|
@@ -3,24 +3,23 @@ import tsfnz from '../common/tsfnz';
|
|
|
3
3
|
import sign from '../common/sign';
|
|
4
4
|
import adjust_lon from '../common/adjust_lon';
|
|
5
5
|
import phi2z from '../common/phi2z';
|
|
6
|
-
import {HALF_PI, EPSLN} from '../constants/values';
|
|
6
|
+
import { HALF_PI, EPSLN } from '../constants/values';
|
|
7
7
|
export function init() {
|
|
8
|
-
|
|
9
|
-
//double
|
|
10
|
-
//double
|
|
11
|
-
//double
|
|
12
|
-
//double
|
|
13
|
-
//double
|
|
14
|
-
//double
|
|
15
|
-
//double
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
//example: proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
|
|
8
|
+
// double lat0; /* the reference latitude */
|
|
9
|
+
// double long0; /* the reference longitude */
|
|
10
|
+
// double lat1; /* first standard parallel */
|
|
11
|
+
// double lat2; /* second standard parallel */
|
|
12
|
+
// double r_maj; /* major axis */
|
|
13
|
+
// double r_min; /* minor axis */
|
|
14
|
+
// double false_east; /* x offset in meters */
|
|
15
|
+
// double false_north; /* y offset in meters */
|
|
16
|
+
|
|
17
|
+
// the above value can be set with proj4.defs
|
|
18
|
+
// example: proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
|
|
20
19
|
|
|
21
20
|
if (!this.lat2) {
|
|
22
21
|
this.lat2 = this.lat1;
|
|
23
|
-
} //if lat2 is not defined
|
|
22
|
+
} // if lat2 is not defined
|
|
24
23
|
if (!this.k0) {
|
|
25
24
|
this.k0 = 1;
|
|
26
25
|
}
|
|
@@ -44,12 +43,13 @@ export function init() {
|
|
|
44
43
|
var ms2 = msfnz(this.e, sin2, cos2);
|
|
45
44
|
var ts2 = tsfnz(this.e, this.lat2, sin2);
|
|
46
45
|
|
|
47
|
-
var ts0 =
|
|
46
|
+
var ts0 = Math.abs(Math.abs(this.lat0) - HALF_PI) < EPSLN
|
|
47
|
+
? 0 // Handle poles by setting ts0 to 0
|
|
48
|
+
: tsfnz(this.e, this.lat0, Math.sin(this.lat0));
|
|
48
49
|
|
|
49
50
|
if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
|
|
50
51
|
this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
52
|
+
} else {
|
|
53
53
|
this.ns = sin1;
|
|
54
54
|
}
|
|
55
55
|
if (isNaN(this.ns)) {
|
|
@@ -58,14 +58,13 @@ export function init() {
|
|
|
58
58
|
this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
|
|
59
59
|
this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
|
|
60
60
|
if (!this.title) {
|
|
61
|
-
this.title =
|
|
61
|
+
this.title = 'Lambert Conformal Conic';
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// Lambert Conformal conic forward equations--mapping lat,long to x,y
|
|
66
66
|
// -----------------------------------------------------------------
|
|
67
67
|
export function forward(p) {
|
|
68
|
-
|
|
69
68
|
var lon = p.x;
|
|
70
69
|
var lat = p.y;
|
|
71
70
|
|
|
@@ -79,8 +78,7 @@ export function forward(p) {
|
|
|
79
78
|
if (con > EPSLN) {
|
|
80
79
|
ts = tsfnz(this.e, lat, Math.sin(lat));
|
|
81
80
|
rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
81
|
+
} else {
|
|
84
82
|
con = lat * this.ns;
|
|
85
83
|
if (con <= 0) {
|
|
86
84
|
return null;
|
|
@@ -97,7 +95,6 @@ export function forward(p) {
|
|
|
97
95
|
// Lambert Conformal Conic inverse equations--mapping x,y to lat/long
|
|
98
96
|
// -----------------------------------------------------------------
|
|
99
97
|
export function inverse(p) {
|
|
100
|
-
|
|
101
98
|
var rh1, con, ts;
|
|
102
99
|
var lat, lon;
|
|
103
100
|
var x = (p.x - this.x0) / this.k0;
|
|
@@ -105,8 +102,7 @@ export function inverse(p) {
|
|
|
105
102
|
if (this.ns > 0) {
|
|
106
103
|
rh1 = Math.sqrt(x * x + y * y);
|
|
107
104
|
con = 1;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
105
|
+
} else {
|
|
110
106
|
rh1 = -Math.sqrt(x * x + y * y);
|
|
111
107
|
con = -1;
|
|
112
108
|
}
|
|
@@ -121,8 +117,7 @@ export function inverse(p) {
|
|
|
121
117
|
if (lat === -9999) {
|
|
122
118
|
return null;
|
|
123
119
|
}
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
120
|
+
} else {
|
|
126
121
|
lat = -HALF_PI;
|
|
127
122
|
}
|
|
128
123
|
lon = adjust_lon(theta / this.ns + this.long0);
|
|
@@ -133,13 +128,13 @@ export function inverse(p) {
|
|
|
133
128
|
}
|
|
134
129
|
|
|
135
130
|
export var names = [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
131
|
+
'Lambert Tangential Conformal Conic Projection',
|
|
132
|
+
'Lambert_Conformal_Conic',
|
|
133
|
+
'Lambert_Conformal_Conic_1SP',
|
|
134
|
+
'Lambert_Conformal_Conic_2SP',
|
|
135
|
+
'lcc',
|
|
136
|
+
'Lambert Conic Conformal (1SP)',
|
|
137
|
+
'Lambert Conic Conformal (2SP)'
|
|
143
138
|
];
|
|
144
139
|
|
|
145
140
|
export default {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export function init() {
|
|
2
|
-
//no-op for longlat
|
|
2
|
+
// no-op for longlat
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
function identity(pt) {
|
|
6
6
|
return pt;
|
|
7
7
|
}
|
|
8
|
-
export {identity as forward};
|
|
9
|
-
export {identity as inverse};
|
|
10
|
-
export var names = [
|
|
8
|
+
export { identity as forward };
|
|
9
|
+
export { identity as inverse };
|
|
10
|
+
export var names = ['longlat', 'identity'];
|
|
11
11
|
export default {
|
|
12
12
|
init: init,
|
|
13
13
|
forward: identity,
|
package/lib/projections/merc.js
CHANGED
|
@@ -3,31 +3,28 @@ import msfnz from '../common/msfnz';
|
|
|
3
3
|
import adjust_lon from '../common/adjust_lon';
|
|
4
4
|
import tsfnz from '../common/tsfnz';
|
|
5
5
|
import phi2z from '../common/phi2z';
|
|
6
|
-
import {FORTPI, R2D, EPSLN, HALF_PI} from '../constants/values';
|
|
6
|
+
import { FORTPI, R2D, EPSLN, HALF_PI } from '../constants/values';
|
|
7
7
|
export function init() {
|
|
8
8
|
var con = this.b / this.a;
|
|
9
9
|
this.es = 1 - con * con;
|
|
10
|
-
if(!('x0' in this)){
|
|
10
|
+
if (!('x0' in this)) {
|
|
11
11
|
this.x0 = 0;
|
|
12
12
|
}
|
|
13
|
-
if(!('y0' in this)){
|
|
13
|
+
if (!('y0' in this)) {
|
|
14
14
|
this.y0 = 0;
|
|
15
15
|
}
|
|
16
16
|
this.e = Math.sqrt(this.es);
|
|
17
17
|
if (this.lat_ts) {
|
|
18
18
|
if (this.sphere) {
|
|
19
19
|
this.k0 = Math.cos(this.lat_ts);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
20
|
+
} else {
|
|
22
21
|
this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
|
|
23
22
|
}
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
23
|
+
} else {
|
|
26
24
|
if (!this.k0) {
|
|
27
25
|
if (this.k) {
|
|
28
26
|
this.k0 = this.k;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
27
|
+
} else {
|
|
31
28
|
this.k0 = 1;
|
|
32
29
|
}
|
|
33
30
|
}
|
|
@@ -35,7 +32,7 @@ export function init() {
|
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
/* Mercator forward equations--mapping lat,long to x,y
|
|
38
|
-
|
|
35
|
+
-------------------------------------------------- */
|
|
39
36
|
|
|
40
37
|
export function forward(p) {
|
|
41
38
|
var lon = p.x;
|
|
@@ -48,13 +45,11 @@ export function forward(p) {
|
|
|
48
45
|
var x, y;
|
|
49
46
|
if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
|
|
50
47
|
return null;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
48
|
+
} else {
|
|
53
49
|
if (this.sphere) {
|
|
54
50
|
x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
|
|
55
51
|
y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
52
|
+
} else {
|
|
58
53
|
var sinphi = Math.sin(lat);
|
|
59
54
|
var ts = tsfnz(this.e, lat, sinphi);
|
|
60
55
|
x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
|
|
@@ -67,17 +62,15 @@ export function forward(p) {
|
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
/* Mercator inverse equations--mapping x,y to lat/long
|
|
70
|
-
|
|
65
|
+
-------------------------------------------------- */
|
|
71
66
|
export function inverse(p) {
|
|
72
|
-
|
|
73
67
|
var x = p.x - this.x0;
|
|
74
68
|
var y = p.y - this.y0;
|
|
75
69
|
var lon, lat;
|
|
76
70
|
|
|
77
71
|
if (this.sphere) {
|
|
78
72
|
lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
73
|
+
} else {
|
|
81
74
|
var ts = Math.exp(-y / (this.a * this.k0));
|
|
82
75
|
lat = phi2z(this.e, ts);
|
|
83
76
|
if (lat === -9999) {
|
|
@@ -91,7 +84,7 @@ export function inverse(p) {
|
|
|
91
84
|
return p;
|
|
92
85
|
}
|
|
93
86
|
|
|
94
|
-
export var names = [
|
|
87
|
+
export var names = ['Mercator', 'Popular Visualisation Pseudo Mercator', 'Mercator_1SP', 'Mercator_Auxiliary_Sphere', 'Mercator_Variant_A', 'merc'];
|
|
95
88
|
export default {
|
|
96
89
|
init: init,
|
|
97
90
|
forward: forward,
|