proj4 2.20.8 → 2.20.9

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/lib/Proj.js CHANGED
@@ -32,6 +32,8 @@ function Projection(srsCode, callback) {
32
32
  this.init = null;
33
33
  /** @type {string} */
34
34
  this.name;
35
+ /** @type {string} */
36
+ this.axis;
35
37
  /** @type {Array<string>} */
36
38
  this.names = null;
37
39
  /** @type {string} */
@@ -1,57 +1,79 @@
1
- export default function (crs, denorm, point) {
2
- var xin = point.x,
3
- yin = point.y,
4
- zin = point.z || 0.0;
5
- var v, t, i;
1
+ var order = ['x', 'y', 'z'];
2
+
3
+ /**
4
+ * Convert a point in a given CRS axis order to ENU (east/north/up) order
5
+ * @param {import('./defs').ProjectionDefinition} crs
6
+ * @param {import('./core').InterfaceCoordinates} point
7
+ * @returns {import('./core').InterfaceCoordinates | null}
8
+ */
9
+ export function adjustAxisToEnu(crs, point) {
6
10
  /** @type {import("./core").InterfaceCoordinates} */
7
- var out = {};
8
- for (i = 0; i < 3; i++) {
9
- if (denorm && i === 2 && point.z === undefined) {
11
+ const out = {};
12
+ for (let i = 0, ii = crs.axis.length; i < ii; i++) {
13
+ if (i === 2 && point.z === undefined) {
10
14
  continue;
11
15
  }
12
- if (i === 0) {
13
- v = xin;
14
- if ('ew'.indexOf(crs.axis[i]) !== -1) {
15
- t = 'x';
16
- } else {
17
- t = 'y';
18
- }
19
- } else if (i === 1) {
20
- v = yin;
21
- if ('ns'.indexOf(crs.axis[i]) !== -1) {
22
- t = 'y';
23
- } else {
24
- t = 'x';
25
- }
26
- } else {
27
- v = zin;
28
- t = 'z';
16
+ let v = point[order[i]];
17
+ switch (crs.axis[i]) {
18
+ case 'e':
19
+ out.x = v;
20
+ break;
21
+ case 'w':
22
+ out.x = -v;
23
+ break;
24
+ case 'n':
25
+ out.y = v;
26
+ break;
27
+ case 's':
28
+ out.y = -v;
29
+ break;
30
+ case 'u':
31
+ out.z = v;
32
+ break;
33
+ case 'd':
34
+ out.z = -v;
35
+ break;
36
+ default:
37
+ // console.log("ERROR: unknown axis ("+crs.axis[i]+") - check definition of "+crs.projName);
38
+ return null;
39
+ }
40
+ }
41
+ return out;
42
+ }
43
+
44
+ /**
45
+ * Convert a point in ENU (east/north/up) order to the given CRS axis order.
46
+ * @param {import('./defs').ProjectionDefinition} crs
47
+ * @param {import('./core').InterfaceCoordinates} point
48
+ * @returns {import('./core').InterfaceCoordinates | null}
49
+ */
50
+ export function adjustAxisFromEnu(crs, point) {
51
+ const out = /** @type {import("./core").InterfaceCoordinates} */ ({});
52
+ for (let i = 0, ii = crs.axis.length; i < ii; i++) {
53
+ if (i === 2 && point.z === undefined) {
54
+ continue;
29
55
  }
30
56
  switch (crs.axis[i]) {
31
57
  case 'e':
32
- out[t] = v;
58
+ out[order[i]] = point.x;
33
59
  break;
34
60
  case 'w':
35
- out[t] = -v;
61
+ out[order[i]] = -point.x;
36
62
  break;
37
63
  case 'n':
38
- out[t] = v;
64
+ out[order[i]] = point.y;
39
65
  break;
40
66
  case 's':
41
- out[t] = -v;
67
+ out[order[i]] = -point.y;
42
68
  break;
43
69
  case 'u':
44
- if (point[t] !== undefined) {
45
- out.z = v;
46
- }
70
+ out[order[i]] = point.z;
47
71
  break;
48
72
  case 'd':
49
- if (point[t] !== undefined) {
50
- out.z = -v;
51
- }
73
+ out[order[i]] = -point.z;
52
74
  break;
53
75
  default:
54
- // console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
76
+ // console.log("ERROR: unknown axis ("+crs.axis[i]+") - check definition of "+crs.projName);
55
77
  return null;
56
78
  }
57
79
  }
@@ -0,0 +1,4 @@
1
+ export default function authlat(beta, APA) {
2
+ var t = beta + beta;
3
+ return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
4
+ }
@@ -0,0 +1,20 @@
1
+ var P00 = 0.33333333333333333333;
2
+ var P01 = 0.17222222222222222222;
3
+ var P02 = 0.10257936507936507936;
4
+ var P10 = 0.06388888888888888888;
5
+ var P11 = 0.06640211640211640211;
6
+ var P20 = 0.01641501294219154443;
7
+
8
+ export default function authset(es) {
9
+ var t;
10
+ var APA = [];
11
+ APA[0] = es * P00;
12
+ t = es * es;
13
+ APA[0] += t * P01;
14
+ APA[1] = t * P10;
15
+ t *= es;
16
+ APA[0] += t * P02;
17
+ APA[1] += t * P11;
18
+ APA[2] = t * P20;
19
+ return APA;
20
+ }
package/lib/core.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import proj from './Proj';
2
- import transform from './transform';
2
+ import { transformInternal } from './transform';
3
+ import toPoint from './common/toPoint';
3
4
  var wgs84 = proj('WGS84');
4
5
 
5
6
  /**
@@ -82,37 +83,36 @@ var wgs84 = proj('WGS84');
82
83
  * @returns {T}
83
84
  */
84
85
  function transformer(from, to, coords, enforceAxis) {
85
- var transformedArray, out, keys;
86
+ var out, geocent, keys;
86
87
  if (Array.isArray(coords)) {
87
- transformedArray = transform(from, to, coords, enforceAxis) || { x: NaN, y: NaN };
88
+ out = transformInternal(from, to, toPoint(coords), enforceAxis) || { x: NaN, y: NaN };
88
89
  if (coords.length > 2) {
89
- if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
90
- if (typeof transformedArray.z === 'number') {
91
- return /** @type {T} */ ([transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.slice(3)));
92
- } else {
93
- return /** @type {T} */ ([transformedArray.x, transformedArray.y, coords[2]].concat(coords.slice(3)));
90
+ geocent = (typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent');
91
+ if (geocent) {
92
+ if (typeof out.z === 'number') {
93
+ return /** @type {T} */ ([out.x, out.y, out.z].concat(coords.slice(3)));
94
94
  }
95
- } else {
96
- return /** @type {T} */ ([transformedArray.x, transformedArray.y].concat(coords.slice(2)));
95
+ return /** @type {T} */ ([out.x, out.y, coords[2]].concat(coords.slice(3)));
97
96
  }
98
- } else {
99
- return /** @type {T} */ ([transformedArray.x, transformedArray.y]);
97
+ if (enforceAxis && typeof out.z === 'number') {
98
+ return /** @type {T} */ ([out.x, out.y, out.z].concat(coords.slice(3)));
99
+ }
100
+ return /** @type {T} */ ([out.x, out.y].concat(coords.slice(2)));
100
101
  }
102
+ return /** @type {T} */ ([out.x, out.y]);
101
103
  } else {
102
- out = transform(from, to, coords, enforceAxis);
104
+ out = transformInternal(from, to, { x: coords.x, y: coords.y, z: coords.z, m: coords.m }, enforceAxis) || { x: NaN, y: NaN };
103
105
  keys = Object.keys(coords);
104
106
  if (keys.length === 2) {
105
107
  return /** @type {T} */ (out);
106
108
  }
109
+ geocent = (typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent');
107
110
  keys.forEach(function (key) {
108
- if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
109
- if (key === 'x' || key === 'y' || key === 'z') {
110
- return;
111
- }
112
- } else {
113
- if (key === 'x' || key === 'y') {
114
- return;
115
- }
111
+ if (key === 'x' || key === 'y') {
112
+ return;
113
+ }
114
+ if (key === 'z' && (geocent || enforceAxis)) {
115
+ return;
116
116
  }
117
117
  out[key] = coords[key];
118
118
  });
package/lib/datum.js CHANGED
@@ -2,14 +2,10 @@ import { PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT, PJD_WGS84, PJD_NODATUM, SEC_TO_R
2
2
 
3
3
  function datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {
4
4
  var out = {};
5
-
6
- if (datumCode === undefined || datumCode === 'none') {
7
- out.datum_type = PJD_NODATUM;
8
- } else {
9
- out.datum_type = PJD_WGS84;
10
- }
5
+ out.datum_type = PJD_NODATUM;
11
6
 
12
7
  if (datum_params) {
8
+ out.datum_type = PJD_WGS84;
13
9
  out.datum_params = datum_params.map(parseFloat);
14
10
  if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
15
11
  out.datum_type = PJD_3PARAM;
@@ -16,6 +16,7 @@ import poly from './projections/poly';
16
16
  import nzmg from './projections/nzmg';
17
17
  import mill from './projections/mill';
18
18
  import sinu from './projections/sinu';
19
+ import eck6 from './projections/eck6';
19
20
  import moll from './projections/moll';
20
21
  import eqdc from './projections/eqdc';
21
22
  import vandg from './projections/vandg';
@@ -49,6 +50,7 @@ var projs = [
49
50
  nzmg,
50
51
  mill,
51
52
  sinu,
53
+ eck6,
52
54
  moll,
53
55
  eqdc,
54
56
  vandg,
package/lib/nadgrid.js CHANGED
@@ -40,22 +40,6 @@
40
40
 
41
41
  /** @typedef {{header: NadgridHeader, subgrids: Array<Subgrid>}} NADGrid */
42
42
 
43
- /**
44
- * @typedef {Object} GeoTIFF
45
- * @property {() => Promise<number>} getImageCount - Returns the number of images in the GeoTIFF.
46
- * @property {(index: number) => Promise<GeoTIFFImage>} getImage - Returns a GeoTIFFImage for the given index.
47
- */
48
-
49
- /**
50
- * @typedef {Object} GeoTIFFImage
51
- * @property {() => number} getWidth - Returns the width of the image.
52
- * @property {() => number} getHeight - Returns the height of the image.
53
- * @property {() => number[]} getBoundingBox - Returns the bounding box as [minX, minY, maxX, maxY] in degrees.
54
- * @property {() => Promise<ArrayLike<ArrayLike<number>>>} readRasters - Returns the raster data as an array of bands.
55
- * @property {Object} fileDirectory - The file directory object containing metadata.
56
- * @property {Object} fileDirectory.ModelPixelScale - The pixel scale array [scaleX, scaleY, scaleZ] in degrees.
57
- */
58
-
59
43
  var loadedNadgrids = {};
60
44
 
61
45
  /**
@@ -68,14 +52,14 @@ var loadedNadgrids = {};
68
52
  /**
69
53
  * @overload
70
54
  * @param {string} key - The key to associate with the loaded grid.
71
- * @param {GeoTIFF} data - The GeoTIFF instance to read the grid from.
55
+ * @param {import('geotiff').GeoTIFF} data - The GeoTIFF instance to read the grid from.
72
56
  * @returns {{ready: Promise<NADGrid>}} - A promise that resolves to the loaded grid information.
73
57
  */
74
58
  /**
75
59
  * Load either a NTv2 file (.gsb) or a Geotiff (.tif) to a key that can be used in a proj string like +nadgrids=<key>. Pass the NTv2 file
76
60
  * as an ArrayBuffer. Pass Geotiff as a GeoTIFF instance from the geotiff.js library.
77
61
  * @param {string} key - The key to associate with the loaded grid.
78
- * @param {ArrayBuffer|GeoTIFF} data The data to load, either an ArrayBuffer for NTv2 or a GeoTIFF instance.
62
+ * @param {ArrayBuffer|import('geotiff').GeoTIFF} data The data to load, either an ArrayBuffer for NTv2 or a GeoTIFF instance.
79
63
  * @param {NTV2GridOptions} [options] Optional parameters.
80
64
  * @returns {{ready: Promise<NADGrid>}|NADGrid} - A promise that resolves to the loaded grid information.
81
65
  */
@@ -108,7 +92,7 @@ function readNTV2Grid(key, data, options) {
108
92
 
109
93
  /**
110
94
  * @param {string} key The key to associate with the loaded grid.
111
- * @param {GeoTIFF} tiff The GeoTIFF instance to read the grid from.
95
+ * @param {import('geotiff').GeoTIFF} tiff The GeoTIFF instance to read the grid from.
112
96
  * @returns {Promise<NADGrid>} A promise that resolves to the loaded NAD grid information.
113
97
  */
114
98
  async function readGeotiffGrid(key, tiff) {
@@ -122,7 +106,12 @@ async function readGeotiffGrid(key, tiff) {
122
106
  var data = rasters;
123
107
  var lim = [image.getWidth(), image.getHeight()];
124
108
  var imageBBoxRadians = image.getBoundingBox().map(degreesToRadians);
125
- var del = [image.fileDirectory.ModelPixelScale[0], image.fileDirectory.ModelPixelScale[1]].map(degreesToRadians);
109
+ var modelPixelScale = typeof image.fileDirectory.getValue === 'function'
110
+ // geotiff v3
111
+ ? image.fileDirectory.getValue('ModelPixelScale')
112
+ // geotiff v2
113
+ : /** @type {any} */ (image.fileDirectory).ModelPixelScale;
114
+ var del = [modelPixelScale[0], modelPixelScale[1]].map(degreesToRadians);
126
115
 
127
116
  var maxX = imageBBoxRadians[0] + (lim[0] - 1) * del[0];
128
117
  var minY = imageBBoxRadians[3] - (lim[1] - 1) * del[1];
@@ -0,0 +1,38 @@
1
+ import { forward as sinuForward, inverse as sinuInverse } from './sinu';
2
+
3
+ /**
4
+ * Eckert VI projection — spherical sinusoidal variant with m=1, n=1+π/2.
5
+ * Always forces spherical computation regardless of the ellipsoid.
6
+ *
7
+ * @typedef {Object} LocalThis
8
+ * @property {number} m
9
+ * @property {number} n
10
+ * @property {number} C_y
11
+ * @property {number} C_x
12
+ * @property {number} es
13
+ */
14
+
15
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
16
+ export function init() {
17
+ /* Force spherical handling */
18
+ this.sphere = true;
19
+ this.b = this.a;
20
+
21
+ this.m = 1.0;
22
+ this.n = 2.570796326794896619231321691; /* 1 + π/2 */
23
+ this.es = 0;
24
+
25
+ this.C_y = Math.sqrt((this.m + 1.0) / this.n);
26
+ this.C_x = this.C_y / (this.m + 1.0);
27
+ }
28
+
29
+ export var forward = sinuForward;
30
+ export var inverse = sinuInverse;
31
+
32
+ export var names = ['Eckert_VI', 'eck6'];
33
+ export default {
34
+ init: init,
35
+ forward: forward,
36
+ inverse: inverse,
37
+ names: names
38
+ };
@@ -28,6 +28,9 @@
28
28
  */
29
29
 
30
30
  import adjust_lon from '../common/adjust_lon';
31
+ import qsfnz from '../common/qsfnz';
32
+ import authset from '../common/authset';
33
+ import authlat from '../common/authlat';
31
34
 
32
35
  var A1 = 1.340264,
33
36
  A2 = -0.081106,
@@ -35,32 +38,62 @@ var A1 = 1.340264,
35
38
  A4 = 0.003796,
36
39
  M = Math.sqrt(3) / 2.0;
37
40
 
41
+ /**
42
+ * @typedef {Object} LocalThis
43
+ * @property {number} es
44
+ * @property {number} e
45
+ * @property {Array<number>} apa
46
+ * @property {number} qp
47
+ * @property {number} rqda
48
+ */
49
+
50
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
38
51
  export function init() {
39
- this.es = 0;
40
52
  this.long0 = this.long0 !== undefined ? this.long0 : 0;
41
53
  this.x0 = this.x0 !== undefined ? this.x0 : 0;
42
54
  this.y0 = this.y0 !== undefined ? this.y0 : 0;
55
+ if (this.es !== 0) {
56
+ this.apa = authset(this.es);
57
+ this.qp = qsfnz(this.e, 1);
58
+ this.rqda = Math.sqrt(0.5 * this.qp);
59
+ }
43
60
  }
44
61
 
62
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
45
63
  export function forward(p) {
46
64
  var lam = adjust_lon(p.x - this.long0, this.over);
47
65
  var phi = p.y;
48
- var paramLat = Math.asin(M * Math.sin(phi)),
66
+ var sinphi = Math.sin(phi);
67
+ if (this.es !== 0) {
68
+ sinphi = qsfnz(this.e, sinphi) / this.qp;
69
+ }
70
+ var paramLat = Math.asin(M * sinphi),
49
71
  paramLatSq = paramLat * paramLat,
50
72
  paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;
51
73
  p.x = lam * Math.cos(paramLat)
52
74
  / (M * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)));
53
75
  p.y = paramLat * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq));
54
76
 
77
+ if (this.es !== 0) {
78
+ p.x *= this.rqda;
79
+ p.y *= this.rqda;
80
+ }
81
+
55
82
  p.x = this.a * p.x + this.x0;
56
83
  p.y = this.a * p.y + this.y0;
57
84
  return p;
58
85
  }
59
86
 
87
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
60
88
  export function inverse(p) {
61
89
  p.x = (p.x - this.x0) / this.a;
62
90
  p.y = (p.y - this.y0) / this.a;
63
91
 
92
+ if (this.es !== 0) {
93
+ p.x /= this.rqda;
94
+ p.y /= this.rqda;
95
+ }
96
+
64
97
  var EPS = 1e-9,
65
98
  NITER = 12,
66
99
  paramLat = p.y,
@@ -82,6 +115,10 @@ export function inverse(p) {
82
115
  / Math.cos(paramLat);
83
116
  p.y = Math.asin(Math.sin(paramLat) / M);
84
117
 
118
+ if (this.es !== 0) {
119
+ p.y = authlat(p.y, this.apa);
120
+ }
121
+
85
122
  p.x = adjust_lon(p.x + this.long0, this.over);
86
123
  return p;
87
124
  }
@@ -2,6 +2,8 @@ import { HALF_PI, EPSLN, FORTPI } from '../constants/values';
2
2
 
3
3
  import qsfnz from '../common/qsfnz';
4
4
  import adjust_lon from '../common/adjust_lon';
5
+ import authset from '../common/authset';
6
+ import authlat from '../common/authlat';
5
7
 
6
8
  /**
7
9
  * @typedef {Object} LocalThis
@@ -264,34 +266,6 @@ export function inverse(p) {
264
266
  return p;
265
267
  }
266
268
 
267
- /* determine latitude from authalic latitude */
268
- var P00 = 0.33333333333333333333;
269
-
270
- var P01 = 0.17222222222222222222;
271
- var P02 = 0.10257936507936507936;
272
- var P10 = 0.06388888888888888888;
273
- var P11 = 0.06640211640211640211;
274
- var P20 = 0.01641501294219154443;
275
-
276
- function authset(es) {
277
- var t;
278
- var APA = [];
279
- APA[0] = es * P00;
280
- t = es * es;
281
- APA[0] += t * P01;
282
- APA[1] = t * P10;
283
- t *= es;
284
- APA[0] += t * P02;
285
- APA[1] += t * P11;
286
- APA[2] = t * P20;
287
- return APA;
288
- }
289
-
290
- function authlat(beta, APA) {
291
- var t = beta + beta;
292
- return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
293
- }
294
-
295
269
  export var names = ['Lambert Azimuthal Equal Area', 'Lambert_Azimuthal_Equal_Area', 'laea'];
296
270
  export default {
297
271
  init: init,
@@ -250,7 +250,7 @@ function createRotation(params, how) {
250
250
  */
251
251
  function forwardOblique(self, lp) {
252
252
  let { x: lam, y: phi } = lp;
253
- lam += self.long0;
253
+ lam = adjust_lon(lam - self.long0, self.over);
254
254
  const coslam = Math.cos(lam);
255
255
  const sinphi = Math.sin(phi);
256
256
  const cosphi = Math.cos(phi);
@@ -280,7 +280,7 @@ function forwardOblique(self, lp) {
280
280
  */
281
281
  function forwardTransverse(self, lp) {
282
282
  let { x: lam, y: phi } = lp;
283
- lam += self.long0;
283
+ lam = adjust_lon(lam - self.long0, self.over);
284
284
  const cosphi = Math.cos(phi);
285
285
  const coslam = Math.cos(lam);
286
286
  lp.x = adjust_lon(
@@ -65,6 +65,10 @@ export function init() {
65
65
 
66
66
  if (gam) {
67
67
  gamma = this.rectified_grid_angle;
68
+ if (!alp) {
69
+ alpha_c = 0;
70
+ alp = true;
71
+ }
68
72
  }
69
73
 
70
74
  if (alp || gam) {
package/lib/transform.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { D2R, R2D, PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT } from './constants/values';
2
2
  import datum_transform from './datum_transform';
3
- import adjust_axis from './adjust_axis';
3
+ import { adjustAxisToEnu, adjustAxisFromEnu } from './adjust_axis';
4
4
  import proj from './Proj';
5
5
  import toPoint from './common/toPoint';
6
6
  import checkSanity from './checkSanity';
@@ -12,36 +12,26 @@ function checkNotWGS(source, dest) {
12
12
  }
13
13
 
14
14
  /**
15
+ * Internal transform: accepts an already-cloned point object, returns transformed point object.
15
16
  * @param {import('./defs').ProjectionDefinition} source
16
17
  * @param {import('./defs').ProjectionDefinition} dest
17
- * @param {import('./core').TemplateCoordinates} point
18
- * @param {boolean} enforceAxis
18
+ * @param {import('./core').InterfaceCoordinates} point
19
+ * @param {boolean} [enforceAxis]
19
20
  * @returns {import('./core').InterfaceCoordinates | undefined}
20
21
  */
21
- export default function transform(source, dest, point, enforceAxis) {
22
+ export function transformInternal(source, dest, point, enforceAxis) {
22
23
  var wgs84;
23
- if (Array.isArray(point)) {
24
- point = toPoint(point);
25
- } else {
26
- // Clone the point object so inputs don't get modified
27
- point = {
28
- x: point.x,
29
- y: point.y,
30
- z: point.z,
31
- m: point.m
32
- };
33
- }
34
24
  var hasZ = point.z !== undefined;
35
25
  checkSanity(point);
36
26
  // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
37
27
  if (source.datum && dest.datum && checkNotWGS(source, dest)) {
38
28
  wgs84 = new proj('WGS84');
39
- point = transform(source, wgs84, point, enforceAxis);
29
+ point = transformInternal(source, wgs84, point, enforceAxis);
40
30
  source = wgs84;
41
31
  }
42
32
  // DGR, 2010/11/12
43
33
  if (enforceAxis && source.axis !== 'enu') {
44
- point = adjust_axis(source, false, point);
34
+ point = adjustAxisToEnu(source, point);
45
35
  }
46
36
  // Transform source points to long/lat, if they aren't already.
47
37
  if (source.projName === 'longlat') {
@@ -105,7 +95,7 @@ export default function transform(source, dest, point, enforceAxis) {
105
95
 
106
96
  // DGR, 2010/11/12
107
97
  if (enforceAxis && dest.axis !== 'enu') {
108
- return adjust_axis(dest, true, point);
98
+ return adjustAxisFromEnu(dest, point);
109
99
  }
110
100
 
111
101
  if (point && !hasZ && dest.projName !== 'geocent') {
@@ -113,3 +103,21 @@ export default function transform(source, dest, point, enforceAxis) {
113
103
  }
114
104
  return point;
115
105
  }
106
+
107
+ /**
108
+ * @param {import('./defs').ProjectionDefinition} source
109
+ * @param {import('./defs').ProjectionDefinition} dest
110
+ * @param {import('./core').TemplateCoordinates} point
111
+ * @param {boolean} [enforceAxis]
112
+ * @returns {import('./core').InterfaceCoordinates | undefined}
113
+ */
114
+ export default function transform(source, dest, point, enforceAxis) {
115
+ var pt;
116
+ if (Array.isArray(point)) {
117
+ pt = toPoint(point);
118
+ } else {
119
+ // Clone the point object so inputs don't get modified
120
+ pt = { x: point.x, y: point.y, z: point.z, m: point.m };
121
+ }
122
+ return transformInternal(source, dest, pt, enforceAxis);
123
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proj4",
3
- "version": "2.20.8",
3
+ "version": "2.20.9",
4
4
  "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
5
5
  "homepage": "https://proj4js.github.io/proj4js/",
6
6
  "main": "dist/proj4-src.js",
@@ -13,8 +13,9 @@
13
13
  "build:custom": "node scripts/build.mjs",
14
14
  "prerollup": "npm run types",
15
15
  "rollup": "rollup -c",
16
- "pretest": "npm run lint",
16
+ "pretest": "npm run lint && npm run typecheck",
17
17
  "lint": "eslint *.js *.mjs scripts lib test",
18
+ "typecheck": "tsc --noEmit",
18
19
  "format": "npm run lint -- --fix",
19
20
  "test": "npm run build && npm run test:all",
20
21
  "test:coverage": "vitest run --coverage",
@@ -40,11 +41,19 @@
40
41
  "@vitest/browser-playwright": "^4.1.2",
41
42
  "@vitest/coverage-v8": "^4.1.2",
42
43
  "eslint": "^9.25.1",
43
- "geotiff": "^2.1.4-beta.0",
44
+ "geotiff": "^3.0.5",
44
45
  "rollup": "^4.9.6",
45
46
  "typescript": "^5.8.3",
46
47
  "vitest": "^4.1.2"
47
48
  },
49
+ "peerDependencies": {
50
+ "geotiff": "*"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "geotiff": {
54
+ "optional": true
55
+ }
56
+ },
48
57
  "dependencies": {
49
58
  "mgrs": "1.0.0",
50
59
  "wkt-parser": "^1.5.5"
package/projs.js CHANGED
@@ -17,6 +17,7 @@ import poly from './lib/projections/poly';
17
17
  import nzmg from './lib/projections/nzmg';
18
18
  import mill from './lib/projections/mill';
19
19
  import sinu from './lib/projections/sinu';
20
+ import eck6 from './lib/projections/eck6';
20
21
  import moll from './lib/projections/moll';
21
22
  import eqdc from './lib/projections/eqdc';
22
23
  import vandg from './lib/projections/vandg';
@@ -50,6 +51,7 @@ export default function (proj4) {
50
51
  proj4.Proj.projections.add(nzmg);
51
52
  proj4.Proj.projections.add(mill);
52
53
  proj4.Proj.projections.add(sinu);
54
+ proj4.Proj.projections.add(eck6);
53
55
  proj4.Proj.projections.add(moll);
54
56
  proj4.Proj.projections.add(eqdc);
55
57
  proj4.Proj.projections.add(vandg);
package/tsconfig.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "allowJs": true,
4
4
  "checkJs": true,
5
+ "noImplicitAny": false,
5
6
  "skipLibCheck": true,
6
7
  "emitDeclarationOnly": true,
7
8
  "declaration": true,