proj4 2.19.10 → 2.20.1-alpha

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.
Files changed (46) hide show
  1. package/Gruntfile.js +2 -1
  2. package/README.md +2 -0
  3. package/bower.json +1 -1
  4. package/changelog.md +2 -0
  5. package/component.json +1 -1
  6. package/dist/lib/common/adjust_lon.d.ts +1 -1
  7. package/dist/lib/defs.d.ts +2 -0
  8. package/dist/lib/projections/eqearth.d.ts +2 -0
  9. package/dist/lib/projections/moll.d.ts +7 -1
  10. package/dist/lib/projections/ob_tran.d.ts +78 -0
  11. package/dist/proj4-src.js +708 -338
  12. package/dist/proj4.js +1 -1
  13. package/lib/common/adjust_lon.js +4 -1
  14. package/lib/defs.js +8 -0
  15. package/lib/global.js +2 -0
  16. package/lib/includedProjections.js +3 -1
  17. package/lib/projString.js +4 -0
  18. package/lib/projections/aea.js +2 -2
  19. package/lib/projections/aeqd.js +6 -6
  20. package/lib/projections/bonne.js +4 -4
  21. package/lib/projections/cass.js +2 -2
  22. package/lib/projections/cea.js +3 -3
  23. package/lib/projections/eqc.js +2 -2
  24. package/lib/projections/eqdc.js +3 -3
  25. package/lib/projections/eqearth.js +4 -2
  26. package/lib/projections/equi.js +2 -2
  27. package/lib/projections/etmerc.js +2 -2
  28. package/lib/projections/gnom.js +2 -2
  29. package/lib/projections/krovak.js +1 -1
  30. package/lib/projections/laea.js +2 -2
  31. package/lib/projections/lcc.js +2 -2
  32. package/lib/projections/merc.js +3 -3
  33. package/lib/projections/mill.js +2 -2
  34. package/lib/projections/moll.js +10 -3
  35. package/lib/projections/ob_tran.js +347 -0
  36. package/lib/projections/omerc.js +2 -2
  37. package/lib/projections/ortho.js +4 -4
  38. package/lib/projections/poly.js +5 -5
  39. package/lib/projections/robin.js +2 -2
  40. package/lib/projections/sinu.js +3 -3
  41. package/lib/projections/stere.js +6 -6
  42. package/lib/projections/sterea.js +2 -2
  43. package/lib/projections/tmerc.js +3 -3
  44. package/lib/projections/vandg.js +2 -2
  45. package/package.json +1 -1
  46. package/projs.js +2 -0
@@ -1,6 +1,9 @@
1
1
  import { TWO_PI, SPI } from '../constants/values';
2
2
  import sign from './sign';
3
3
 
4
- export default function (x) {
4
+ export default function (x, skipAdjust) {
5
+ if (skipAdjust) {
6
+ return x;
7
+ }
5
8
  return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
6
9
  }
package/lib/defs.js CHANGED
@@ -37,6 +37,8 @@ import wkt from 'wkt-parser';
37
37
  * @property {boolean} [sphere]
38
38
  * @property {number} [rectified_grid_angle]
39
39
  * @property {boolean} [approx]
40
+ * @property {boolean} [over]
41
+ * @property {string} [projStr]
40
42
  * @property {<T extends import('./core').TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} inverse
41
43
  * @property {<T extends import('./core').TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} forward
42
44
  */
@@ -73,8 +75,14 @@ function defs(name) {
73
75
  } else {
74
76
  defs[/** @type {string} */ (name)] = wkt(arguments[1]);
75
77
  }
78
+ } else if (def && typeof def === 'object' && !('projName' in def)) {
79
+ // PROJJSON
80
+ defs[/** @type {string} */ (name)] = wkt(arguments[1]);
76
81
  } else {
77
82
  defs[/** @type {string} */ (name)] = def;
83
+ if (!def) {
84
+ delete defs[/** @type {string} */ (name)];
85
+ }
78
86
  }
79
87
  } else if (arguments.length === 1) {
80
88
  if (Array.isArray(name)) {
package/lib/global.js CHANGED
@@ -7,6 +7,8 @@ export default function (defs) {
7
7
  defs('EPSG:' + (32600 + i), '+proj=utm +zone=' + i + ' +datum=WGS84 +units=m');
8
8
  defs('EPSG:' + (32700 + i), '+proj=utm +zone=' + i + ' +south +datum=WGS84 +units=m');
9
9
  }
10
+ defs('EPSG:5041', '+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m');
11
+ defs('EPSG:5042', '+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m');
10
12
 
11
13
  defs.WGS84 = defs['EPSG:4326'];
12
14
  defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857
@@ -28,6 +28,7 @@ import tpers from './projections/tpers';
28
28
  import geos from './projections/geos';
29
29
  import eqearth from './projections/eqearth';
30
30
  import bonne from './projections/bonne';
31
+ import ob_tran from './projections/ob_tran';
31
32
 
32
33
  var projs = [
33
34
  tmerc,
@@ -59,7 +60,8 @@ var projs = [
59
60
  tpers,
60
61
  geos,
61
62
  eqearth,
62
- bonne
63
+ bonne,
64
+ ob_tran
63
65
  ];
64
66
 
65
67
  export default function (proj4) {
package/lib/projString.js CHANGED
@@ -125,6 +125,9 @@ export default function (defData) {
125
125
  },
126
126
  approx: function () {
127
127
  self.approx = true;
128
+ },
129
+ over: function () {
130
+ self.over = true;
128
131
  }
129
132
  };
130
133
  for (paramName in paramObj) {
@@ -143,5 +146,6 @@ export default function (defData) {
143
146
  if (typeof self.datumCode === 'string' && self.datumCode !== 'WGS84') {
144
147
  self.datumCode = self.datumCode.toLowerCase();
145
148
  }
149
+ self['projStr'] = defData;
146
150
  return self;
147
151
  }
@@ -75,7 +75,7 @@ export function forward(p) {
75
75
 
76
76
  var qs = qsfnz(this.e3, this.sin_phi);
77
77
  var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
78
- var theta = this.ns0 * adjust_lon(lon - this.long0);
78
+ var theta = this.ns0 * adjust_lon(lon - this.long0, this.over);
79
79
  var x = rh1 * Math.sin(theta) + this.x0;
80
80
  var y = this.rh - rh1 * Math.cos(theta) + this.y0;
81
81
 
@@ -108,7 +108,7 @@ export function inverse(p) {
108
108
  lat = this.phi1z(this.e3, qs);
109
109
  }
110
110
 
111
- lon = adjust_lon(theta / this.ns0 + this.long0);
111
+ lon = adjust_lon(theta / this.ns0 + this.long0, this.over);
112
112
  p.x = lon;
113
113
  p.y = lat;
114
114
  return p;
@@ -31,7 +31,7 @@ export function forward(p) {
31
31
  var lat = p.y;
32
32
  var sinphi = Math.sin(p.y);
33
33
  var cosphi = Math.cos(p.y);
34
- var dlon = adjust_lon(lon - this.long0);
34
+ var dlon = adjust_lon(lon - this.long0, this.over);
35
35
  var e0, e1, e2, e3, Mlp, Ml, c, kp, cos_c, vars, azi1;
36
36
  if (this.sphere) {
37
37
  if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
@@ -109,12 +109,12 @@ export function inverse(p) {
109
109
  con = Math.abs(this.lat0) - HALF_PI;
110
110
  if (Math.abs(con) <= EPSLN) {
111
111
  if (this.lat0 >= 0) {
112
- lon = adjust_lon(this.long0 + Math.atan2(p.x, -p.y));
112
+ lon = adjust_lon(this.long0 + Math.atan2(p.x, -p.y), this.over);
113
113
  } else {
114
- lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
114
+ lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y), this.over);
115
115
  }
116
116
  } else {
117
- lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
117
+ lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz), this.over);
118
118
  }
119
119
  }
120
120
 
@@ -132,7 +132,7 @@ export function inverse(p) {
132
132
  rh = Math.sqrt(p.x * p.x + p.y * p.y);
133
133
  M = Mlp - rh;
134
134
  lat = imlfn(M / this.a, e0, e1, e2, e3);
135
- lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y));
135
+ lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y), this.over);
136
136
  p.x = lon;
137
137
  p.y = lat;
138
138
  return p;
@@ -143,7 +143,7 @@ export function inverse(p) {
143
143
  M = rh - Mlp;
144
144
 
145
145
  lat = imlfn(M / this.a, e0, e1, e2, e3);
146
- lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
146
+ lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y), this.over);
147
147
  p.x = lon;
148
148
  p.y = lat;
149
149
  return p;
@@ -45,7 +45,7 @@ export function init() {
45
45
  }
46
46
 
47
47
  function e_fwd(p) {
48
- var lam = adjust_lon(p.x - (this.long0 || 0));
48
+ var lam = adjust_lon(p.x - (this.long0 || 0), this.over);
49
49
  var phi = p.y;
50
50
  var rh, E, c;
51
51
  rh = this.am1 + this.m1 - pj_mlfn(phi, E = Math.sin(phi), c = Math.cos(phi), this.en);
@@ -73,13 +73,13 @@ function e_inv(p) {
73
73
  } else {
74
74
  throw new Error();
75
75
  }
76
- p.x = adjust_lon(lam + (this.long0 || 0));
76
+ p.x = adjust_lon(lam + (this.long0 || 0), this.over);
77
77
  p.y = adjust_lat(phi);
78
78
  return p;
79
79
  }
80
80
 
81
81
  function s_fwd(p) {
82
- var lam = adjust_lon(p.x - (this.long0 || 0));
82
+ var lam = adjust_lon(p.x - (this.long0 || 0), this.over);
83
83
  var phi = p.y;
84
84
  var E, rh;
85
85
  rh = this.cphi1 + this.phi1 - phi;
@@ -110,7 +110,7 @@ function s_inv(p) {
110
110
  } else {
111
111
  lam = rh * Math.atan2(p.x, p.y) / Math.cos(phi);
112
112
  }
113
- p.x = adjust_lon(lam + (this.long0 || 0));
113
+ p.x = adjust_lon(lam + (this.long0 || 0), this.over);
114
114
  p.y = adjust_lat(phi);
115
115
  return p;
116
116
  }
@@ -38,7 +38,7 @@ export function forward(p) {
38
38
  var x, y;
39
39
  var lam = p.x;
40
40
  var phi = p.y;
41
- lam = adjust_lon(lam - this.long0);
41
+ lam = adjust_lon(lam - this.long0, this.over);
42
42
 
43
43
  if (this.sphere) {
44
44
  x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
@@ -98,7 +98,7 @@ export function inverse(p) {
98
98
  lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
99
99
  }
100
100
 
101
- p.x = adjust_lon(lam + this.long0);
101
+ p.x = adjust_lon(lam + this.long0, this.over);
102
102
  p.y = adjust_lat(phi);
103
103
  return p;
104
104
  }
@@ -30,7 +30,7 @@ export function forward(p) {
30
30
  var x, y;
31
31
  /* Forward equations
32
32
  ----------------- */
33
- var dlon = adjust_lon(lon - this.long0);
33
+ var dlon = adjust_lon(lon - this.long0, this.over);
34
34
  if (this.sphere) {
35
35
  x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
36
36
  y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
@@ -53,11 +53,11 @@ export function inverse(p) {
53
53
  var lon, lat;
54
54
 
55
55
  if (this.sphere) {
56
- lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
56
+ lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts), this.over);
57
57
  lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
58
58
  } else {
59
59
  lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
60
- lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
60
+ lon = adjust_lon(this.long0 + p.x / (this.a * this.k0), this.over);
61
61
  }
62
62
 
63
63
  p.x = lon;
@@ -18,7 +18,7 @@ export function forward(p) {
18
18
  var lon = p.x;
19
19
  var lat = p.y;
20
20
 
21
- var dlon = adjust_lon(lon - this.long0);
21
+ var dlon = adjust_lon(lon - this.long0, this.over);
22
22
  var dlat = adjust_lat(lat - this.lat0);
23
23
  p.x = this.x0 + (this.a * dlon * this.rc);
24
24
  p.y = this.y0 + (this.a * dlat);
@@ -31,7 +31,7 @@ export function inverse(p) {
31
31
  var x = p.x;
32
32
  var y = p.y;
33
33
 
34
- p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
34
+ p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)), this.over);
35
35
  p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
36
36
  return p;
37
37
  }
@@ -82,7 +82,7 @@ export function forward(p) {
82
82
  var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
83
83
  rh1 = this.a * (this.g - ml);
84
84
  }
85
- var theta = this.ns * adjust_lon(lon - this.long0);
85
+ var theta = this.ns * adjust_lon(lon - this.long0, this.over);
86
86
  var x = this.x0 + rh1 * Math.sin(theta);
87
87
  var y = this.y0 + this.rh - rh1 * Math.cos(theta);
88
88
  p.x = x;
@@ -109,7 +109,7 @@ export function inverse(p) {
109
109
  }
110
110
 
111
111
  if (this.sphere) {
112
- lon = adjust_lon(this.long0 + theta / this.ns);
112
+ lon = adjust_lon(this.long0 + theta / this.ns, this.over);
113
113
  lat = adjust_lat(this.g - rh1 / this.a);
114
114
  p.x = lon;
115
115
  p.y = lat;
@@ -117,7 +117,7 @@ export function inverse(p) {
117
117
  } else {
118
118
  var ml = this.g - rh1 / this.a;
119
119
  lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
120
- lon = adjust_lon(this.long0 + theta / this.ns);
120
+ lon = adjust_lon(this.long0 + theta / this.ns, this.over);
121
121
  p.x = lon;
122
122
  p.y = lat;
123
123
  return p;
@@ -38,10 +38,12 @@ var A1 = 1.340264,
38
38
  export function init() {
39
39
  this.es = 0;
40
40
  this.long0 = this.long0 !== undefined ? this.long0 : 0;
41
+ this.x0 = this.x0 !== undefined ? this.x0 : 0;
42
+ this.y0 = this.y0 !== undefined ? this.y0 : 0;
41
43
  }
42
44
 
43
45
  export function forward(p) {
44
- var lam = adjust_lon(p.x - this.long0);
46
+ var lam = adjust_lon(p.x - this.long0, this.over);
45
47
  var phi = p.y;
46
48
  var paramLat = Math.asin(M * Math.sin(phi)),
47
49
  paramLatSq = paramLat * paramLat,
@@ -80,7 +82,7 @@ export function inverse(p) {
80
82
  / Math.cos(paramLat);
81
83
  p.y = Math.asin(Math.sin(paramLat) / M);
82
84
 
83
- p.x = adjust_lon(p.x + this.long0);
85
+ p.x = adjust_lon(p.x + this.long0, this.over);
84
86
  return p;
85
87
  }
86
88
 
@@ -23,7 +23,7 @@ export function forward(p) {
23
23
  var lon = p.x;
24
24
  var lat = p.y;
25
25
 
26
- var dlon = adjust_lon(lon - this.long0);
26
+ var dlon = adjust_lon(lon - this.long0, this.over);
27
27
  var x = this.x0 + this.a * dlon * Math.cos(this.lat0);
28
28
  var y = this.y0 + this.a * lat;
29
29
 
@@ -41,7 +41,7 @@ export function inverse(p) {
41
41
  p.y -= this.y0;
42
42
  var lat = p.y / this.a;
43
43
 
44
- var lon = adjust_lon(this.long0 + p.x / (this.a * Math.cos(this.lat0)));
44
+ var lon = adjust_lon(this.long0 + p.x / (this.a * Math.cos(this.lat0)), this.over);
45
45
  p.x = lon;
46
46
  p.y = lat;
47
47
  }
@@ -100,7 +100,7 @@ export function init() {
100
100
  }
101
101
 
102
102
  export function forward(p) {
103
- var Ce = adjust_lon(p.x - this.long0);
103
+ var Ce = adjust_lon(p.x - this.long0, this.over);
104
104
  var Cn = p.y;
105
105
 
106
106
  Cn = gatg(this.cbg, Cn);
@@ -160,7 +160,7 @@ export function inverse(p) {
160
160
  Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
161
161
  Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
162
162
 
163
- lon = adjust_lon(Ce + this.long0);
163
+ lon = adjust_lon(Ce + this.long0, this.over);
164
164
  lat = gatg(this.cgb, Cn);
165
165
  } else {
166
166
  lon = Infinity;
@@ -40,7 +40,7 @@ export function forward(p) {
40
40
  var lat = p.y;
41
41
  /* Forward equations
42
42
  ----------------- */
43
- dlon = adjust_lon(lon - this.long0);
43
+ dlon = adjust_lon(lon - this.long0, this.over);
44
44
 
45
45
  sinphi = Math.sin(lat);
46
46
  cosphi = Math.cos(lat);
@@ -88,7 +88,7 @@ export function inverse(p) {
88
88
 
89
89
  lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
90
90
  lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
91
- lon = adjust_lon(this.long0 + lon);
91
+ lon = adjust_lon(this.long0 + lon, this.over);
92
92
  } else {
93
93
  lat = this.phic0;
94
94
  lon = 0;
@@ -39,7 +39,7 @@ export function forward(p) {
39
39
  var gfi, u, deltav, s, d, eps, ro;
40
40
  var lon = p.x;
41
41
  var lat = p.y;
42
- var delta_lon = adjust_lon(lon - this.long0);
42
+ var delta_lon = adjust_lon(lon - this.long0, this.over);
43
43
  /* Transformation */
44
44
  gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));
45
45
  u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
@@ -91,7 +91,7 @@ export function forward(p) {
91
91
  var lam = p.x;
92
92
  var phi = p.y;
93
93
 
94
- lam = adjust_lon(lam - this.long0);
94
+ lam = adjust_lon(lam - this.long0, this.over);
95
95
  if (this.sphere) {
96
96
  sinphi = Math.sin(phi);
97
97
  cosphi = Math.cos(phi);
@@ -259,7 +259,7 @@ export function inverse(p) {
259
259
  phi = authlat(Math.asin(ab), this.apa);
260
260
  }
261
261
 
262
- p.x = adjust_lon(this.long0 + lam);
262
+ p.x = adjust_lon(this.long0 + lam, this.over);
263
263
  p.y = phi;
264
264
  return p;
265
265
  }
@@ -95,7 +95,7 @@ export function forward(p) {
95
95
  }
96
96
  rh1 = 0;
97
97
  }
98
- var theta = this.ns * adjust_lon(lon - this.long0);
98
+ var theta = this.ns * adjust_lon(lon - this.long0, this.over);
99
99
  p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
100
100
  p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
101
101
 
@@ -130,7 +130,7 @@ export function inverse(p) {
130
130
  } else {
131
131
  lat = -HALF_PI;
132
132
  }
133
- lon = adjust_lon(theta / this.ns + this.long0);
133
+ lon = adjust_lon(theta / this.ns + this.long0, this.over);
134
134
 
135
135
  p.x = lon;
136
136
  p.y = lat;
@@ -56,12 +56,12 @@ export function forward(p) {
56
56
  return null;
57
57
  } else {
58
58
  if (this.sphere) {
59
- x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
59
+ x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0, this.over);
60
60
  y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
61
61
  } else {
62
62
  var sinphi = Math.sin(lat);
63
63
  var ts = tsfnz(this.e, lat, sinphi);
64
- x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
64
+ x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0, this.over);
65
65
  y = this.y0 - this.a * this.k0 * Math.log(ts);
66
66
  }
67
67
  p.x = x;
@@ -86,7 +86,7 @@ export function inverse(p) {
86
86
  return null;
87
87
  }
88
88
  }
89
- lon = adjust_lon(this.long0 + x / (this.a * this.k0));
89
+ lon = adjust_lon(this.long0 + x / (this.a * this.k0), this.over);
90
90
 
91
91
  p.x = lon;
92
92
  p.y = lat;
@@ -19,7 +19,7 @@ export function forward(p) {
19
19
  var lat = p.y;
20
20
  /* Forward equations
21
21
  ----------------- */
22
- var dlon = adjust_lon(lon - this.long0);
22
+ var dlon = adjust_lon(lon - this.long0, this.over);
23
23
  var x = this.x0 + this.a * dlon;
24
24
  var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;
25
25
 
@@ -34,7 +34,7 @@ export function inverse(p) {
34
34
  p.x -= this.x0;
35
35
  p.y -= this.y0;
36
36
 
37
- var lon = adjust_lon(this.long0 + p.x / this.a);
37
+ var lon = adjust_lon(this.long0 + p.x / this.a, this.over);
38
38
  var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
39
39
 
40
40
  p.x = lon;
@@ -1,6 +1,13 @@
1
1
  import adjust_lon from '../common/adjust_lon';
2
- export function init() {}
3
2
  import { EPSLN } from '../constants/values';
3
+
4
+ /** @this {import('../defs.js').ProjectionDefinition} */
5
+ export function init() {
6
+ this.x0 = this.x0 !== undefined ? this.x0 : 0;
7
+ this.y0 = this.y0 !== undefined ? this.y0 : 0;
8
+ this.long0 = this.long0 !== undefined ? this.long0 : 0;
9
+ }
10
+
4
11
  /* Mollweide forward equations--mapping lat,long to x,y
5
12
  ---------------------------------------------------- */
6
13
  export function forward(p) {
@@ -9,7 +16,7 @@ export function forward(p) {
9
16
  var lon = p.x;
10
17
  var lat = p.y;
11
18
 
12
- var delta_lon = adjust_lon(lon - this.long0);
19
+ var delta_lon = adjust_lon(lon - this.long0, this.over);
13
20
  var theta = lat;
14
21
  var con = Math.PI * Math.sin(lat);
15
22
 
@@ -55,7 +62,7 @@ export function inverse(p) {
55
62
  arg = 0.999999999999;
56
63
  }
57
64
  theta = Math.asin(arg);
58
- var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));
65
+ var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))), this.over);
59
66
  if (lon < (-Math.PI)) {
60
67
  lon = -Math.PI;
61
68
  }