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/dist/proj4-src.js CHANGED
@@ -1724,7 +1724,7 @@
1724
1724
  */
1725
1725
 
1726
1726
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
1727
- function init$y() {
1727
+ function init$z() {
1728
1728
  var con = this.b / this.a;
1729
1729
  this.es = 1 - con * con;
1730
1730
  if (!('x0' in this)) {
@@ -1754,7 +1754,7 @@
1754
1754
  /* Mercator forward equations--mapping lat,long to x,y
1755
1755
  -------------------------------------------------- */
1756
1756
 
1757
- function forward$w(p) {
1757
+ function forward$x(p) {
1758
1758
  var lon = p.x;
1759
1759
  var lat = p.y;
1760
1760
  // convert to radians
@@ -1783,7 +1783,7 @@
1783
1783
 
1784
1784
  /* Mercator inverse equations--mapping x,y to lat/long
1785
1785
  -------------------------------------------------- */
1786
- function inverse$w(p) {
1786
+ function inverse$x(p) {
1787
1787
  var x = p.x - this.x0;
1788
1788
  var y = p.y - this.y0;
1789
1789
  var lon, lat;
@@ -1804,32 +1804,32 @@
1804
1804
  return p;
1805
1805
  }
1806
1806
 
1807
- var names$y = ['Mercator', 'Popular Visualisation Pseudo Mercator', 'Mercator_1SP', 'Mercator_Auxiliary_Sphere', 'Mercator_Variant_A', 'merc'];
1807
+ var names$z = ['Mercator', 'Popular Visualisation Pseudo Mercator', 'Mercator_1SP', 'Mercator_Auxiliary_Sphere', 'Mercator_Variant_A', 'merc'];
1808
1808
  var merc = {
1809
- init: init$y,
1810
- forward: forward$w,
1811
- inverse: inverse$w,
1812
- names: names$y
1809
+ init: init$z,
1810
+ forward: forward$x,
1811
+ inverse: inverse$x,
1812
+ names: names$z
1813
1813
  };
1814
1814
 
1815
- function init$x() {
1815
+ function init$y() {
1816
1816
  // no-op for longlat
1817
1817
  }
1818
1818
 
1819
1819
  function identity(pt) {
1820
1820
  return pt;
1821
1821
  }
1822
- var names$x = ['longlat', 'identity'];
1822
+ var names$y = ['longlat', 'identity'];
1823
1823
  var longlat = {
1824
- init: init$x,
1824
+ init: init$y,
1825
1825
  forward: identity,
1826
1826
  inverse: identity,
1827
- names: names$x
1827
+ names: names$y
1828
1828
  };
1829
1829
 
1830
1830
  /** @type {Array<Partial<import('./Proj').default>>} */
1831
1831
  var projs = [merc, longlat];
1832
- var names$w = {};
1832
+ var names$x = {};
1833
1833
  var projStore = [];
1834
1834
 
1835
1835
  /**
@@ -1844,7 +1844,7 @@
1844
1844
  }
1845
1845
  projStore[len] = proj;
1846
1846
  proj.names.forEach(function (n) {
1847
- names$w[n.toLowerCase()] = len;
1847
+ names$x[n.toLowerCase()] = len;
1848
1848
  });
1849
1849
  return this;
1850
1850
  }
@@ -1863,12 +1863,12 @@
1863
1863
  return false;
1864
1864
  }
1865
1865
  var n = name.toLowerCase();
1866
- if (typeof names$w[n] !== 'undefined' && projStore[names$w[n]]) {
1867
- return projStore[names$w[n]];
1866
+ if (typeof names$x[n] !== 'undefined' && projStore[names$x[n]]) {
1867
+ return projStore[names$x[n]];
1868
1868
  }
1869
1869
  n = getNormalizedProjName(n);
1870
- if (n in names$w && projStore[names$w[n]]) {
1871
- return projStore[names$w[n]];
1870
+ if (n in names$x && projStore[names$x[n]]) {
1871
+ return projStore[names$x[n]];
1872
1872
  }
1873
1873
  }
1874
1874
 
@@ -3515,14 +3515,10 @@
3515
3515
 
3516
3516
  function datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {
3517
3517
  var out = {};
3518
-
3519
- if (datumCode === undefined || datumCode === 'none') {
3520
- out.datum_type = PJD_NODATUM;
3521
- } else {
3522
- out.datum_type = PJD_WGS84;
3523
- }
3518
+ out.datum_type = PJD_NODATUM;
3524
3519
 
3525
3520
  if (datum_params) {
3521
+ out.datum_type = PJD_WGS84;
3526
3522
  out.datum_params = datum_params.map(parseFloat);
3527
3523
  if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
3528
3524
  out.datum_type = PJD_3PARAM;
@@ -3591,22 +3587,6 @@
3591
3587
 
3592
3588
  /** @typedef {{header: NadgridHeader, subgrids: Array<Subgrid>}} NADGrid */
3593
3589
 
3594
- /**
3595
- * @typedef {Object} GeoTIFF
3596
- * @property {() => Promise<number>} getImageCount - Returns the number of images in the GeoTIFF.
3597
- * @property {(index: number) => Promise<GeoTIFFImage>} getImage - Returns a GeoTIFFImage for the given index.
3598
- */
3599
-
3600
- /**
3601
- * @typedef {Object} GeoTIFFImage
3602
- * @property {() => number} getWidth - Returns the width of the image.
3603
- * @property {() => number} getHeight - Returns the height of the image.
3604
- * @property {() => number[]} getBoundingBox - Returns the bounding box as [minX, minY, maxX, maxY] in degrees.
3605
- * @property {() => Promise<ArrayLike<ArrayLike<number>>>} readRasters - Returns the raster data as an array of bands.
3606
- * @property {Object} fileDirectory - The file directory object containing metadata.
3607
- * @property {Object} fileDirectory.ModelPixelScale - The pixel scale array [scaleX, scaleY, scaleZ] in degrees.
3608
- */
3609
-
3610
3590
  var loadedNadgrids = {};
3611
3591
 
3612
3592
  /**
@@ -3619,14 +3599,14 @@
3619
3599
  /**
3620
3600
  * @overload
3621
3601
  * @param {string} key - The key to associate with the loaded grid.
3622
- * @param {GeoTIFF} data - The GeoTIFF instance to read the grid from.
3602
+ * @param {import('geotiff').GeoTIFF} data - The GeoTIFF instance to read the grid from.
3623
3603
  * @returns {{ready: Promise<NADGrid>}} - A promise that resolves to the loaded grid information.
3624
3604
  */
3625
3605
  /**
3626
3606
  * 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
3627
3607
  * as an ArrayBuffer. Pass Geotiff as a GeoTIFF instance from the geotiff.js library.
3628
3608
  * @param {string} key - The key to associate with the loaded grid.
3629
- * @param {ArrayBuffer|GeoTIFF} data The data to load, either an ArrayBuffer for NTv2 or a GeoTIFF instance.
3609
+ * @param {ArrayBuffer|import('geotiff').GeoTIFF} data The data to load, either an ArrayBuffer for NTv2 or a GeoTIFF instance.
3630
3610
  * @param {NTV2GridOptions} [options] Optional parameters.
3631
3611
  * @returns {{ready: Promise<NADGrid>}|NADGrid} - A promise that resolves to the loaded grid information.
3632
3612
  */
@@ -3659,7 +3639,7 @@
3659
3639
 
3660
3640
  /**
3661
3641
  * @param {string} key The key to associate with the loaded grid.
3662
- * @param {GeoTIFF} tiff The GeoTIFF instance to read the grid from.
3642
+ * @param {import('geotiff').GeoTIFF} tiff The GeoTIFF instance to read the grid from.
3663
3643
  * @returns {Promise<NADGrid>} A promise that resolves to the loaded NAD grid information.
3664
3644
  */
3665
3645
  async function readGeotiffGrid(key, tiff) {
@@ -3673,7 +3653,12 @@
3673
3653
  var data = rasters;
3674
3654
  var lim = [image.getWidth(), image.getHeight()];
3675
3655
  var imageBBoxRadians = image.getBoundingBox().map(degreesToRadians);
3676
- var del = [image.fileDirectory.ModelPixelScale[0], image.fileDirectory.ModelPixelScale[1]].map(degreesToRadians);
3656
+ var modelPixelScale = typeof image.fileDirectory.getValue === 'function'
3657
+ // geotiff v3
3658
+ ? image.fileDirectory.getValue('ModelPixelScale')
3659
+ // geotiff v2
3660
+ : /** @type {any} */ (image.fileDirectory).ModelPixelScale;
3661
+ var del = [modelPixelScale[0], modelPixelScale[1]].map(degreesToRadians);
3677
3662
 
3678
3663
  var maxX = imageBBoxRadians[0] + (lim[0] - 1) * del[0];
3679
3664
  var minY = imageBBoxRadians[3] - (lim[1] - 1) * del[1];
@@ -3882,6 +3867,8 @@
3882
3867
  this.init = null;
3883
3868
  /** @type {string} */
3884
3869
  this.name;
3870
+ /** @type {string} */
3871
+ this.axis;
3885
3872
  /** @type {Array<string>} */
3886
3873
  this.names = null;
3887
3874
  /** @type {string} */
@@ -4373,60 +4360,82 @@
4373
4360
  return val;
4374
4361
  }
4375
4362
 
4376
- function adjust_axis (crs, denorm, point) {
4377
- var xin = point.x,
4378
- yin = point.y,
4379
- zin = point.z || 0.0;
4380
- var v, t, i;
4363
+ var order = ['x', 'y', 'z'];
4364
+
4365
+ /**
4366
+ * Convert a point in a given CRS axis order to ENU (east/north/up) order
4367
+ * @param {import('./defs').ProjectionDefinition} crs
4368
+ * @param {import('./core').InterfaceCoordinates} point
4369
+ * @returns {import('./core').InterfaceCoordinates | null}
4370
+ */
4371
+ function adjustAxisToEnu(crs, point) {
4381
4372
  /** @type {import("./core").InterfaceCoordinates} */
4382
- var out = {};
4383
- for (i = 0; i < 3; i++) {
4384
- if (denorm && i === 2 && point.z === undefined) {
4373
+ const out = {};
4374
+ for (let i = 0, ii = crs.axis.length; i < ii; i++) {
4375
+ if (i === 2 && point.z === undefined) {
4385
4376
  continue;
4386
4377
  }
4387
- if (i === 0) {
4388
- v = xin;
4389
- if ('ew'.indexOf(crs.axis[i]) !== -1) {
4390
- t = 'x';
4391
- } else {
4392
- t = 'y';
4393
- }
4394
- } else if (i === 1) {
4395
- v = yin;
4396
- if ('ns'.indexOf(crs.axis[i]) !== -1) {
4397
- t = 'y';
4398
- } else {
4399
- t = 'x';
4400
- }
4401
- } else {
4402
- v = zin;
4403
- t = 'z';
4378
+ let v = point[order[i]];
4379
+ switch (crs.axis[i]) {
4380
+ case 'e':
4381
+ out.x = v;
4382
+ break;
4383
+ case 'w':
4384
+ out.x = -v;
4385
+ break;
4386
+ case 'n':
4387
+ out.y = v;
4388
+ break;
4389
+ case 's':
4390
+ out.y = -v;
4391
+ break;
4392
+ case 'u':
4393
+ out.z = v;
4394
+ break;
4395
+ case 'd':
4396
+ out.z = -v;
4397
+ break;
4398
+ default:
4399
+ // console.log("ERROR: unknown axis ("+crs.axis[i]+") - check definition of "+crs.projName);
4400
+ return null;
4401
+ }
4402
+ }
4403
+ return out;
4404
+ }
4405
+
4406
+ /**
4407
+ * Convert a point in ENU (east/north/up) order to the given CRS axis order.
4408
+ * @param {import('./defs').ProjectionDefinition} crs
4409
+ * @param {import('./core').InterfaceCoordinates} point
4410
+ * @returns {import('./core').InterfaceCoordinates | null}
4411
+ */
4412
+ function adjustAxisFromEnu(crs, point) {
4413
+ const out = /** @type {import("./core").InterfaceCoordinates} */ ({});
4414
+ for (let i = 0, ii = crs.axis.length; i < ii; i++) {
4415
+ if (i === 2 && point.z === undefined) {
4416
+ continue;
4404
4417
  }
4405
4418
  switch (crs.axis[i]) {
4406
4419
  case 'e':
4407
- out[t] = v;
4420
+ out[order[i]] = point.x;
4408
4421
  break;
4409
4422
  case 'w':
4410
- out[t] = -v;
4423
+ out[order[i]] = -point.x;
4411
4424
  break;
4412
4425
  case 'n':
4413
- out[t] = v;
4426
+ out[order[i]] = point.y;
4414
4427
  break;
4415
4428
  case 's':
4416
- out[t] = -v;
4429
+ out[order[i]] = -point.y;
4417
4430
  break;
4418
4431
  case 'u':
4419
- if (point[t] !== undefined) {
4420
- out.z = v;
4421
- }
4432
+ out[order[i]] = point.z;
4422
4433
  break;
4423
4434
  case 'd':
4424
- if (point[t] !== undefined) {
4425
- out.z = -v;
4426
- }
4435
+ out[order[i]] = -point.z;
4427
4436
  break;
4428
4437
  default:
4429
- // console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
4438
+ // console.log("ERROR: unknown axis ("+crs.axis[i]+") - check definition of "+crs.projName);
4430
4439
  return null;
4431
4440
  }
4432
4441
  }
@@ -4474,36 +4483,26 @@
4474
4483
  }
4475
4484
 
4476
4485
  /**
4486
+ * Internal transform: accepts an already-cloned point object, returns transformed point object.
4477
4487
  * @param {import('./defs').ProjectionDefinition} source
4478
4488
  * @param {import('./defs').ProjectionDefinition} dest
4479
- * @param {import('./core').TemplateCoordinates} point
4480
- * @param {boolean} enforceAxis
4489
+ * @param {import('./core').InterfaceCoordinates} point
4490
+ * @param {boolean} [enforceAxis]
4481
4491
  * @returns {import('./core').InterfaceCoordinates | undefined}
4482
4492
  */
4483
- function transform(source, dest, point, enforceAxis) {
4493
+ function transformInternal(source, dest, point, enforceAxis) {
4484
4494
  var wgs84;
4485
- if (Array.isArray(point)) {
4486
- point = common(point);
4487
- } else {
4488
- // Clone the point object so inputs don't get modified
4489
- point = {
4490
- x: point.x,
4491
- y: point.y,
4492
- z: point.z,
4493
- m: point.m
4494
- };
4495
- }
4496
4495
  var hasZ = point.z !== undefined;
4497
4496
  checkSanity(point);
4498
4497
  // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
4499
4498
  if (source.datum && dest.datum && checkNotWGS(source, dest)) {
4500
4499
  wgs84 = new Projection('WGS84');
4501
- point = transform(source, wgs84, point, enforceAxis);
4500
+ point = transformInternal(source, wgs84, point, enforceAxis);
4502
4501
  source = wgs84;
4503
4502
  }
4504
4503
  // DGR, 2010/11/12
4505
4504
  if (enforceAxis && source.axis !== 'enu') {
4506
- point = adjust_axis(source, false, point);
4505
+ point = adjustAxisToEnu(source, point);
4507
4506
  }
4508
4507
  // Transform source points to long/lat, if they aren't already.
4509
4508
  if (source.projName === 'longlat') {
@@ -4567,7 +4566,7 @@
4567
4566
 
4568
4567
  // DGR, 2010/11/12
4569
4568
  if (enforceAxis && dest.axis !== 'enu') {
4570
- return adjust_axis(dest, true, point);
4569
+ return adjustAxisFromEnu(dest, point);
4571
4570
  }
4572
4571
 
4573
4572
  if (point && !hasZ && dest.projName !== 'geocent') {
@@ -4576,6 +4575,24 @@
4576
4575
  return point;
4577
4576
  }
4578
4577
 
4578
+ /**
4579
+ * @param {import('./defs').ProjectionDefinition} source
4580
+ * @param {import('./defs').ProjectionDefinition} dest
4581
+ * @param {import('./core').TemplateCoordinates} point
4582
+ * @param {boolean} [enforceAxis]
4583
+ * @returns {import('./core').InterfaceCoordinates | undefined}
4584
+ */
4585
+ function transform(source, dest, point, enforceAxis) {
4586
+ var pt;
4587
+ if (Array.isArray(point)) {
4588
+ pt = common(point);
4589
+ } else {
4590
+ // Clone the point object so inputs don't get modified
4591
+ pt = { x: point.x, y: point.y, z: point.z, m: point.m };
4592
+ }
4593
+ return transformInternal(source, dest, pt, enforceAxis);
4594
+ }
4595
+
4579
4596
  var wgs84 = Projection('WGS84');
4580
4597
 
4581
4598
  /**
@@ -4658,37 +4675,36 @@
4658
4675
  * @returns {T}
4659
4676
  */
4660
4677
  function transformer(from, to, coords, enforceAxis) {
4661
- var transformedArray, out, keys;
4678
+ var out, geocent, keys;
4662
4679
  if (Array.isArray(coords)) {
4663
- transformedArray = transform(from, to, coords, enforceAxis) || { x: NaN, y: NaN };
4680
+ out = transformInternal(from, to, common(coords), enforceAxis) || { x: NaN, y: NaN };
4664
4681
  if (coords.length > 2) {
4665
- if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
4666
- if (typeof transformedArray.z === 'number') {
4667
- return /** @type {T} */ ([transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.slice(3)));
4668
- } else {
4669
- return /** @type {T} */ ([transformedArray.x, transformedArray.y, coords[2]].concat(coords.slice(3)));
4682
+ geocent = (typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent');
4683
+ if (geocent) {
4684
+ if (typeof out.z === 'number') {
4685
+ return /** @type {T} */ ([out.x, out.y, out.z].concat(coords.slice(3)));
4670
4686
  }
4671
- } else {
4672
- return /** @type {T} */ ([transformedArray.x, transformedArray.y].concat(coords.slice(2)));
4687
+ return /** @type {T} */ ([out.x, out.y, coords[2]].concat(coords.slice(3)));
4673
4688
  }
4674
- } else {
4675
- return /** @type {T} */ ([transformedArray.x, transformedArray.y]);
4689
+ if (enforceAxis && typeof out.z === 'number') {
4690
+ return /** @type {T} */ ([out.x, out.y, out.z].concat(coords.slice(3)));
4691
+ }
4692
+ return /** @type {T} */ ([out.x, out.y].concat(coords.slice(2)));
4676
4693
  }
4694
+ return /** @type {T} */ ([out.x, out.y]);
4677
4695
  } else {
4678
- out = transform(from, to, coords, enforceAxis);
4696
+ out = transformInternal(from, to, { x: coords.x, y: coords.y, z: coords.z, m: coords.m }, enforceAxis) || { x: NaN, y: NaN };
4679
4697
  keys = Object.keys(coords);
4680
4698
  if (keys.length === 2) {
4681
4699
  return /** @type {T} */ (out);
4682
4700
  }
4701
+ geocent = (typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent');
4683
4702
  keys.forEach(function (key) {
4684
- if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
4685
- if (key === 'x' || key === 'y' || key === 'z') {
4686
- return;
4687
- }
4688
- } else {
4689
- if (key === 'x' || key === 'y') {
4690
- return;
4691
- }
4703
+ if (key === 'x' || key === 'y') {
4704
+ return;
4705
+ }
4706
+ if (key === 'z' && (geocent || enforceAxis)) {
4707
+ return;
4692
4708
  }
4693
4709
  out[key] = coords[key];
4694
4710
  });
@@ -4827,8 +4843,8 @@
4827
4843
  var V = 86; // V
4828
4844
  var Z = 90; // Z
4829
4845
  var mgrs = {
4830
- forward: forward$v,
4831
- inverse: inverse$v,
4846
+ forward: forward$w,
4847
+ inverse: inverse$w,
4832
4848
  toPoint: toPoint
4833
4849
  };
4834
4850
  /**
@@ -4840,7 +4856,7 @@
4840
4856
  * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
4841
4857
  * @return {string} the MGRS string for the given location and accuracy.
4842
4858
  */
4843
- function forward$v(ll, accuracy) {
4859
+ function forward$w(ll, accuracy) {
4844
4860
  accuracy = accuracy || 5; // default accuracy 1m
4845
4861
  return encode(LLtoUTM({
4846
4862
  lat: ll[1],
@@ -4855,7 +4871,7 @@
4855
4871
  * (longitude) and top (latitude) values in WGS84, representing the
4856
4872
  * bounding box for the provided MGRS reference.
4857
4873
  */
4858
- function inverse$v(mgrs) {
4874
+ function inverse$w(mgrs) {
4859
4875
  var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
4860
4876
  if (bbox.lat && bbox.lon) {
4861
4877
  return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
@@ -5573,7 +5589,7 @@
5573
5589
  return new Point(toPoint(mgrsStr));
5574
5590
  };
5575
5591
  Point.prototype.toMGRS = function (accuracy) {
5576
- return forward$v([this.x, this.y], accuracy);
5592
+ return forward$w([this.x, this.y], accuracy);
5577
5593
  };
5578
5594
 
5579
5595
  var C00 = 1;
@@ -5639,7 +5655,7 @@
5639
5655
  */
5640
5656
 
5641
5657
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
5642
- function init$w() {
5658
+ function init$x() {
5643
5659
  this.x0 = this.x0 !== undefined ? this.x0 : 0;
5644
5660
  this.y0 = this.y0 !== undefined ? this.y0 : 0;
5645
5661
  this.long0 = this.long0 !== undefined ? this.long0 : 0;
@@ -5655,7 +5671,7 @@
5655
5671
  Transverse Mercator Forward - long/lat to x/y
5656
5672
  long/lat in radians
5657
5673
  */
5658
- function forward$u(p) {
5674
+ function forward$v(p) {
5659
5675
  var lon = p.x;
5660
5676
  var lat = p.y;
5661
5677
 
@@ -5726,7 +5742,7 @@
5726
5742
  /**
5727
5743
  Transverse Mercator Inverse - x/y to long/lat
5728
5744
  */
5729
- function inverse$u(p) {
5745
+ function inverse$v(p) {
5730
5746
  var con, phi;
5731
5747
  var lat, lon;
5732
5748
  var x = (p.x - this.x0) * (1 / this.a);
@@ -5787,12 +5803,12 @@
5787
5803
  return p;
5788
5804
  }
5789
5805
 
5790
- var names$v = ['Fast_Transverse_Mercator', 'Fast Transverse Mercator'];
5806
+ var names$w = ['Fast_Transverse_Mercator', 'Fast Transverse Mercator'];
5791
5807
  var tmerc = {
5792
- init: init$w,
5793
- forward: forward$u,
5794
- inverse: inverse$u,
5795
- names: names$v
5808
+ init: init$x,
5809
+ forward: forward$v,
5810
+ inverse: inverse$v,
5811
+ names: names$w
5796
5812
  };
5797
5813
 
5798
5814
  function sinh (x) {
@@ -5908,7 +5924,7 @@
5908
5924
  */
5909
5925
 
5910
5926
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
5911
- function init$v() {
5927
+ function init$w() {
5912
5928
  if (!this.approx && (isNaN(this.es) || this.es <= 0)) {
5913
5929
  throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');
5914
5930
  }
@@ -5985,7 +6001,7 @@
5985
6001
  this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
5986
6002
  }
5987
6003
 
5988
- function forward$t(p) {
6004
+ function forward$u(p) {
5989
6005
  var Ce = adjust_lon(p.x - this.long0, this.over);
5990
6006
  var Cn = p.y;
5991
6007
 
@@ -6021,7 +6037,7 @@
6021
6037
  return p;
6022
6038
  }
6023
6039
 
6024
- function inverse$t(p) {
6040
+ function inverse$u(p) {
6025
6041
  var Ce = (p.x - this.x0) * (1 / this.a);
6026
6042
  var Cn = (p.y - this.y0) * (1 / this.a);
6027
6043
 
@@ -6059,12 +6075,12 @@
6059
6075
  return p;
6060
6076
  }
6061
6077
 
6062
- var names$u = ['Extended_Transverse_Mercator', 'Extended Transverse Mercator', 'etmerc', 'Transverse_Mercator', 'Transverse Mercator', 'Gauss Kruger', 'Gauss_Kruger', 'tmerc'];
6078
+ var names$v = ['Extended_Transverse_Mercator', 'Extended Transverse Mercator', 'etmerc', 'Transverse_Mercator', 'Transverse Mercator', 'Gauss Kruger', 'Gauss_Kruger', 'tmerc'];
6063
6079
  var etmerc = {
6064
- init: init$v,
6065
- forward: forward$t,
6066
- inverse: inverse$t,
6067
- names: names$u
6080
+ init: init$w,
6081
+ forward: forward$u,
6082
+ inverse: inverse$u,
6083
+ names: names$v
6068
6084
  };
6069
6085
 
6070
6086
  function adjust_zone (zone, lon) {
@@ -6083,7 +6099,7 @@
6083
6099
  var dependsOn = 'etmerc';
6084
6100
 
6085
6101
  /** @this {import('../defs.js').ProjectionDefinition} */
6086
- function init$u() {
6102
+ function init$v() {
6087
6103
  var zone = adjust_zone(this.zone, this.long0);
6088
6104
  if (zone === undefined) {
6089
6105
  throw new Error('unknown utm zone');
@@ -6099,10 +6115,10 @@
6099
6115
  this.inverse = etmerc.inverse;
6100
6116
  }
6101
6117
 
6102
- var names$t = ['Universal Transverse Mercator System', 'utm'];
6118
+ var names$u = ['Universal Transverse Mercator System', 'utm'];
6103
6119
  var utm = {
6104
- init: init$u,
6105
- names: names$t,
6120
+ init: init$v,
6121
+ names: names$u,
6106
6122
  dependsOn: dependsOn
6107
6123
  };
6108
6124
 
@@ -6124,7 +6140,7 @@
6124
6140
  */
6125
6141
 
6126
6142
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
6127
- function init$t() {
6143
+ function init$u() {
6128
6144
  var sphi = Math.sin(this.lat0);
6129
6145
  var cphi = Math.cos(this.lat0);
6130
6146
  cphi *= cphi;
@@ -6135,7 +6151,7 @@
6135
6151
  this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));
6136
6152
  }
6137
6153
 
6138
- function forward$s(p) {
6154
+ function forward$t(p) {
6139
6155
  var lon = p.x;
6140
6156
  var lat = p.y;
6141
6157
 
@@ -6144,7 +6160,7 @@
6144
6160
  return p;
6145
6161
  }
6146
6162
 
6147
- function inverse$s(p) {
6163
+ function inverse$t(p) {
6148
6164
  var DEL_TOL = 1e-14;
6149
6165
  var lon = p.x / this.C;
6150
6166
  var lat = p.y;
@@ -6165,9 +6181,9 @@
6165
6181
  return p;
6166
6182
  }
6167
6183
  var gauss = {
6168
- init: init$t,
6169
- forward: forward$s,
6170
- inverse: inverse$s};
6184
+ init: init$u,
6185
+ forward: forward$t,
6186
+ inverse: inverse$t};
6171
6187
 
6172
6188
  /**
6173
6189
  * @typedef {Object} LocalThis
@@ -6179,7 +6195,7 @@
6179
6195
  */
6180
6196
 
6181
6197
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
6182
- function init$s() {
6198
+ function init$t() {
6183
6199
  gauss.init.apply(this);
6184
6200
  if (!this.rc) {
6185
6201
  return;
@@ -6192,7 +6208,7 @@
6192
6208
  }
6193
6209
  }
6194
6210
 
6195
- function forward$r(p) {
6211
+ function forward$s(p) {
6196
6212
  var sinc, cosc, cosl, k;
6197
6213
  p.x = adjust_lon(p.x - this.long0, this.over);
6198
6214
  gauss.forward.apply(this, [p]);
@@ -6207,7 +6223,7 @@
6207
6223
  return p;
6208
6224
  }
6209
6225
 
6210
- function inverse$r(p) {
6226
+ function inverse$s(p) {
6211
6227
  var sinc, cosc, lon, lat, rho;
6212
6228
  p.x = (p.x - this.x0) / this.a;
6213
6229
  p.y = (p.y - this.y0) / this.a;
@@ -6232,12 +6248,12 @@
6232
6248
  return p;
6233
6249
  }
6234
6250
 
6235
- var names$s = ['Stereographic_North_Pole', 'Oblique_Stereographic', 'sterea', 'Oblique Stereographic Alternative', 'Double_Stereographic'];
6251
+ var names$t = ['Stereographic_North_Pole', 'Oblique_Stereographic', 'sterea', 'Oblique Stereographic Alternative', 'Double_Stereographic'];
6236
6252
  var sterea = {
6237
- init: init$s,
6238
- forward: forward$r,
6239
- inverse: inverse$r,
6240
- names: names$s
6253
+ init: init$t,
6254
+ forward: forward$s,
6255
+ inverse: inverse$s,
6256
+ names: names$t
6241
6257
  };
6242
6258
 
6243
6259
  /**
@@ -6259,7 +6275,7 @@
6259
6275
  }
6260
6276
 
6261
6277
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
6262
- function init$r() {
6278
+ function init$s() {
6263
6279
  // setting default parameters
6264
6280
  this.x0 = this.x0 || 0;
6265
6281
  this.y0 = this.y0 || 0;
@@ -6298,7 +6314,7 @@
6298
6314
  }
6299
6315
 
6300
6316
  // Stereographic forward equations--mapping lat,long to x,y
6301
- function forward$q(p) {
6317
+ function forward$r(p) {
6302
6318
  var lon = p.x;
6303
6319
  var lat = p.y;
6304
6320
  var sinlat = Math.sin(lat);
@@ -6348,7 +6364,7 @@
6348
6364
  }
6349
6365
 
6350
6366
  //* Stereographic inverse equations--mapping x,y to lat/long
6351
- function inverse$q(p) {
6367
+ function inverse$r(p) {
6352
6368
  p.x -= this.x0;
6353
6369
  p.y -= this.y0;
6354
6370
  var lon, lat, ts, ce, Chi;
@@ -6409,12 +6425,12 @@
6409
6425
  return p;
6410
6426
  }
6411
6427
 
6412
- var names$r = ['stere', 'Stereographic_South_Pole', 'Polar_Stereographic_variant_A', 'Polar_Stereographic_variant_B', 'Polar_Stereographic'];
6428
+ var names$s = ['stere', 'Stereographic_South_Pole', 'Polar_Stereographic_variant_A', 'Polar_Stereographic_variant_B', 'Polar_Stereographic'];
6413
6429
  var stere = {
6414
- init: init$r,
6415
- forward: forward$q,
6416
- inverse: inverse$q,
6417
- names: names$r,
6430
+ init: init$s,
6431
+ forward: forward$r,
6432
+ inverse: inverse$r,
6433
+ names: names$s,
6418
6434
  ssfn_: ssfn_
6419
6435
  };
6420
6436
 
@@ -6436,7 +6452,7 @@
6436
6452
  */
6437
6453
 
6438
6454
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
6439
- function init$q() {
6455
+ function init$r() {
6440
6456
  var phy0 = this.lat0;
6441
6457
  this.lambda0 = this.long0;
6442
6458
  var sinPhy0 = Math.sin(phy0);
@@ -6454,7 +6470,7 @@
6454
6470
  this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
6455
6471
  }
6456
6472
 
6457
- function forward$p(p) {
6473
+ function forward$q(p) {
6458
6474
  var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
6459
6475
  var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
6460
6476
  var S = -this.alpha * (Sa1 + Sa2) + this.K;
@@ -6475,7 +6491,7 @@
6475
6491
  return p;
6476
6492
  }
6477
6493
 
6478
- function inverse$p(p) {
6494
+ function inverse$q(p) {
6479
6495
  var Y = p.x - this.x0;
6480
6496
  var X = p.y - this.y0;
6481
6497
 
@@ -6507,12 +6523,12 @@
6507
6523
  return p;
6508
6524
  }
6509
6525
 
6510
- var names$q = ['somerc'];
6526
+ var names$r = ['somerc'];
6511
6527
  var somerc = {
6512
- init: init$q,
6513
- forward: forward$p,
6514
- inverse: inverse$p,
6515
- names: names$q
6528
+ init: init$r,
6529
+ forward: forward$q,
6530
+ inverse: inverse$q,
6531
+ names: names$r
6516
6532
  };
6517
6533
 
6518
6534
  /**
@@ -6551,7 +6567,7 @@
6551
6567
  * Initialize the Oblique Mercator projection
6552
6568
  * @this {import('../defs.js').ProjectionDefinition & LocalThis}
6553
6569
  */
6554
- function init$p() {
6570
+ function init$q() {
6555
6571
  var con, com, cosph0, D, F, H, L, sinph0, p, J, gamma = 0,
6556
6572
  gamma0, lamc = 0, lam1 = 0, lam2 = 0, phi1 = 0, phi2 = 0, alpha_c = 0;
6557
6573
 
@@ -6576,6 +6592,10 @@
6576
6592
 
6577
6593
  if (gam) {
6578
6594
  gamma = this.rectified_grid_angle;
6595
+ if (!alp) {
6596
+ alpha_c = 0;
6597
+ alp = true;
6598
+ }
6579
6599
  }
6580
6600
 
6581
6601
  if (alp || gam) {
@@ -6680,7 +6700,7 @@
6680
6700
 
6681
6701
  /* Oblique Mercator forward equations--mapping lat,long to x,y
6682
6702
  ---------------------------------------------------------- */
6683
- function forward$o(p) {
6703
+ function forward$p(p) {
6684
6704
  var coords = {};
6685
6705
  var S, T, U, V, W, temp, u, v;
6686
6706
  p.x = p.x - this.lam0;
@@ -6726,7 +6746,7 @@
6726
6746
  return coords;
6727
6747
  }
6728
6748
 
6729
- function inverse$o(p) {
6749
+ function inverse$p(p) {
6730
6750
  var u, v, Qp, Sp, Tp, Vp, Up;
6731
6751
  var coords = {};
6732
6752
 
@@ -6766,12 +6786,12 @@
6766
6786
  return coords;
6767
6787
  }
6768
6788
 
6769
- var names$p = ['Hotine_Oblique_Mercator', 'Hotine Oblique Mercator', 'Hotine_Oblique_Mercator_variant_A', 'Hotine_Oblique_Mercator_Variant_B', 'Hotine_Oblique_Mercator_Azimuth_Natural_Origin', 'Hotine_Oblique_Mercator_Two_Point_Natural_Origin', 'Hotine_Oblique_Mercator_Azimuth_Center', 'Oblique_Mercator', 'omerc'];
6789
+ var names$q = ['Hotine_Oblique_Mercator', 'Hotine Oblique Mercator', 'Hotine_Oblique_Mercator_variant_A', 'Hotine_Oblique_Mercator_Variant_B', 'Hotine_Oblique_Mercator_Azimuth_Natural_Origin', 'Hotine_Oblique_Mercator_Two_Point_Natural_Origin', 'Hotine_Oblique_Mercator_Azimuth_Center', 'Oblique_Mercator', 'omerc'];
6770
6790
  var omerc = {
6771
- init: init$p,
6772
- forward: forward$o,
6773
- inverse: inverse$o,
6774
- names: names$p
6791
+ init: init$q,
6792
+ forward: forward$p,
6793
+ inverse: inverse$p,
6794
+ names: names$q
6775
6795
  };
6776
6796
 
6777
6797
  /**
@@ -6783,7 +6803,7 @@
6783
6803
  */
6784
6804
 
6785
6805
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
6786
- function init$o() {
6806
+ function init$p() {
6787
6807
  // double lat0; /* the reference latitude */
6788
6808
  // double long0; /* the reference longitude */
6789
6809
  // double lat1; /* first standard parallel */
@@ -6843,7 +6863,7 @@
6843
6863
 
6844
6864
  // Lambert Conformal conic forward equations--mapping lat,long to x,y
6845
6865
  // -----------------------------------------------------------------
6846
- function forward$n(p) {
6866
+ function forward$o(p) {
6847
6867
  var lon = p.x;
6848
6868
  var lat = p.y;
6849
6869
 
@@ -6873,7 +6893,7 @@
6873
6893
 
6874
6894
  // Lambert Conformal Conic inverse equations--mapping x,y to lat/long
6875
6895
  // -----------------------------------------------------------------
6876
- function inverse$n(p) {
6896
+ function inverse$o(p) {
6877
6897
  var rh1, con, ts;
6878
6898
  var lat, lon;
6879
6899
  var x = (p.x - this.x0) / this.k0;
@@ -6906,7 +6926,7 @@
6906
6926
  return p;
6907
6927
  }
6908
6928
 
6909
- var names$o = [
6929
+ var names$p = [
6910
6930
  'Lambert Tangential Conformal Conic Projection',
6911
6931
  'Lambert_Conformal_Conic',
6912
6932
  'Lambert_Conformal_Conic_1SP',
@@ -6917,13 +6937,13 @@
6917
6937
  ];
6918
6938
 
6919
6939
  var lcc = {
6920
- init: init$o,
6921
- forward: forward$n,
6922
- inverse: inverse$n,
6923
- names: names$o
6940
+ init: init$p,
6941
+ forward: forward$o,
6942
+ inverse: inverse$o,
6943
+ names: names$p
6924
6944
  };
6925
6945
 
6926
- function init$n() {
6946
+ function init$o() {
6927
6947
  this.a = 6377397.155;
6928
6948
  this.es = 0.006674372230614;
6929
6949
  this.e = Math.sqrt(this.es);
@@ -6958,7 +6978,7 @@
6958
6978
  /* ellipsoid */
6959
6979
  /* calculate xy from lat/lon */
6960
6980
  /* Constants, identical to inverse transform function */
6961
- function forward$m(p) {
6981
+ function forward$n(p) {
6962
6982
  var gfi, u, deltav, s, d, eps, ro;
6963
6983
  var lon = p.x;
6964
6984
  var lat = p.y;
@@ -6982,7 +7002,7 @@
6982
7002
  }
6983
7003
 
6984
7004
  /* calculate lat/lon from xy */
6985
- function inverse$m(p) {
7005
+ function inverse$n(p) {
6986
7006
  var u, deltav, s, d, eps, ro, fi1;
6987
7007
  var ok;
6988
7008
 
@@ -7020,12 +7040,12 @@
7020
7040
  return (p);
7021
7041
  }
7022
7042
 
7023
- var names$n = ['Krovak', 'Krovak Modified', 'Krovak (North Orientated)', 'Krovak Modified (North Orientated)', 'krovak'];
7043
+ var names$o = ['Krovak', 'Krovak Modified', 'Krovak (North Orientated)', 'Krovak Modified (North Orientated)', 'krovak'];
7024
7044
  var krovak = {
7025
- init: init$n,
7026
- forward: forward$m,
7027
- inverse: inverse$m,
7028
- names: names$n
7045
+ init: init$o,
7046
+ forward: forward$n,
7047
+ inverse: inverse$n,
7048
+ names: names$o
7029
7049
  };
7030
7050
 
7031
7051
  function mlfn (e0, e1, e2, e3, phi) {
@@ -7085,7 +7105,7 @@
7085
7105
  */
7086
7106
 
7087
7107
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
7088
- function init$m() {
7108
+ function init$n() {
7089
7109
  if (!this.sphere) {
7090
7110
  this.e0 = e0fn(this.es);
7091
7111
  this.e1 = e1fn(this.es);
@@ -7097,7 +7117,7 @@
7097
7117
 
7098
7118
  /* Cassini forward equations--mapping lat,long to x,y
7099
7119
  ----------------------------------------------------------------------- */
7100
- function forward$l(p) {
7120
+ function forward$m(p) {
7101
7121
  /* Forward equations
7102
7122
  ----------------- */
7103
7123
  var x, y;
@@ -7130,7 +7150,7 @@
7130
7150
 
7131
7151
  /* Inverse equations
7132
7152
  ----------------- */
7133
- function inverse$l(p) {
7153
+ function inverse$m(p) {
7134
7154
  p.x -= this.x0;
7135
7155
  p.y -= this.y0;
7136
7156
  var x = p.x / this.a;
@@ -7168,12 +7188,12 @@
7168
7188
  return p;
7169
7189
  }
7170
7190
 
7171
- var names$m = ['Cassini', 'Cassini_Soldner', 'cass'];
7191
+ var names$n = ['Cassini', 'Cassini_Soldner', 'cass'];
7172
7192
  var cass = {
7173
- init: init$m,
7174
- forward: forward$l,
7175
- inverse: inverse$l,
7176
- names: names$m
7193
+ init: init$n,
7194
+ forward: forward$m,
7195
+ inverse: inverse$m,
7196
+ names: names$n
7177
7197
  };
7178
7198
 
7179
7199
  function qsfnz (eccent, sinphi) {
@@ -7186,6 +7206,32 @@
7186
7206
  }
7187
7207
  }
7188
7208
 
7209
+ var P00 = 0.33333333333333333333;
7210
+ var P01 = 0.17222222222222222222;
7211
+ var P02 = 0.10257936507936507936;
7212
+ var P10 = 0.06388888888888888888;
7213
+ var P11 = 0.06640211640211640211;
7214
+ var P20 = 0.01641501294219154443;
7215
+
7216
+ function authset(es) {
7217
+ var t;
7218
+ var APA = [];
7219
+ APA[0] = es * P00;
7220
+ t = es * es;
7221
+ APA[0] += t * P01;
7222
+ APA[1] = t * P10;
7223
+ t *= es;
7224
+ APA[0] += t * P02;
7225
+ APA[1] += t * P11;
7226
+ APA[2] = t * P20;
7227
+ return APA;
7228
+ }
7229
+
7230
+ function authlat(beta, APA) {
7231
+ var t = beta + beta;
7232
+ return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
7233
+ }
7234
+
7189
7235
  /**
7190
7236
  * @typedef {Object} LocalThis
7191
7237
  * @property {number} mode
@@ -7219,7 +7265,7 @@
7219
7265
  * Initialize the Lambert Azimuthal Equal Area projection
7220
7266
  * @this {import('../defs.js').ProjectionDefinition & LocalThis}
7221
7267
  */
7222
- function init$l() {
7268
+ function init$m() {
7223
7269
  var t = Math.abs(this.lat0);
7224
7270
  if (Math.abs(t - HALF_PI) < EPSLN) {
7225
7271
  this.mode = this.lat0 < 0 ? S_POLE : N_POLE;
@@ -7267,7 +7313,7 @@
7267
7313
 
7268
7314
  /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
7269
7315
  ----------------------------------------------------------------------- */
7270
- function forward$k(p) {
7316
+ function forward$l(p) {
7271
7317
  /* Forward equations
7272
7318
  ----------------- */
7273
7319
  var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
@@ -7360,7 +7406,7 @@
7360
7406
 
7361
7407
  /* Inverse equations
7362
7408
  ----------------- */
7363
- function inverse$k(p) {
7409
+ function inverse$l(p) {
7364
7410
  p.x -= this.x0;
7365
7411
  p.y -= this.y0;
7366
7412
  var x = p.x / this.a;
@@ -7447,40 +7493,12 @@
7447
7493
  return p;
7448
7494
  }
7449
7495
 
7450
- /* determine latitude from authalic latitude */
7451
- var P00 = 0.33333333333333333333;
7452
-
7453
- var P01 = 0.17222222222222222222;
7454
- var P02 = 0.10257936507936507936;
7455
- var P10 = 0.06388888888888888888;
7456
- var P11 = 0.06640211640211640211;
7457
- var P20 = 0.01641501294219154443;
7458
-
7459
- function authset(es) {
7460
- var t;
7461
- var APA = [];
7462
- APA[0] = es * P00;
7463
- t = es * es;
7464
- APA[0] += t * P01;
7465
- APA[1] = t * P10;
7466
- t *= es;
7467
- APA[0] += t * P02;
7468
- APA[1] += t * P11;
7469
- APA[2] = t * P20;
7470
- return APA;
7471
- }
7472
-
7473
- function authlat(beta, APA) {
7474
- var t = beta + beta;
7475
- return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
7476
- }
7477
-
7478
- var names$l = ['Lambert Azimuthal Equal Area', 'Lambert_Azimuthal_Equal_Area', 'laea'];
7496
+ var names$m = ['Lambert Azimuthal Equal Area', 'Lambert_Azimuthal_Equal_Area', 'laea'];
7479
7497
  var laea = {
7480
- init: init$l,
7481
- forward: forward$k,
7482
- inverse: inverse$k,
7483
- names: names$l,
7498
+ init: init$m,
7499
+ forward: forward$l,
7500
+ inverse: inverse$l,
7501
+ names: names$m,
7484
7502
  S_POLE: S_POLE,
7485
7503
  N_POLE: N_POLE,
7486
7504
  EQUIT: EQUIT,
@@ -7518,7 +7536,7 @@
7518
7536
  */
7519
7537
 
7520
7538
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
7521
- function init$k() {
7539
+ function init$l() {
7522
7540
  if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
7523
7541
  return;
7524
7542
  }
@@ -7556,7 +7574,7 @@
7556
7574
  /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
7557
7575
  ------------------------------------------------------------------- */
7558
7576
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
7559
- function forward$j(p) {
7577
+ function forward$k(p) {
7560
7578
  var lon = p.x;
7561
7579
  var lat = p.y;
7562
7580
 
@@ -7574,7 +7592,7 @@
7574
7592
  return p;
7575
7593
  }
7576
7594
 
7577
- function inverse$j(p) {
7595
+ function inverse$k(p) {
7578
7596
  var rh1, qs, con, theta, lon, lat;
7579
7597
 
7580
7598
  p.x -= this.x0;
@@ -7629,12 +7647,12 @@
7629
7647
  return null;
7630
7648
  }
7631
7649
 
7632
- var names$k = ['Albers_Conic_Equal_Area', 'Albers_Equal_Area', 'Albers', 'aea'];
7650
+ var names$l = ['Albers_Conic_Equal_Area', 'Albers_Equal_Area', 'Albers', 'aea'];
7633
7651
  var aea = {
7634
- init: init$k,
7635
- forward: forward$j,
7636
- inverse: inverse$j,
7637
- names: names$k,
7652
+ init: init$l,
7653
+ forward: forward$k,
7654
+ inverse: inverse$k,
7655
+ names: names$l,
7638
7656
  phi1z: phi1z
7639
7657
  };
7640
7658
 
@@ -7653,7 +7671,7 @@
7653
7671
  Accessed: 12th November 2009
7654
7672
  @this {import('../defs.js').ProjectionDefinition & LocalThis}
7655
7673
  */
7656
- function init$j() {
7674
+ function init$k() {
7657
7675
  /* Place parameters in static storage for common use
7658
7676
  ------------------------------------------------- */
7659
7677
  this.sin_p14 = Math.sin(this.lat0);
@@ -7665,7 +7683,7 @@
7665
7683
 
7666
7684
  /* Gnomonic forward equations--mapping lat,long to x,y
7667
7685
  --------------------------------------------------- */
7668
- function forward$i(p) {
7686
+ function forward$j(p) {
7669
7687
  var sinphi, cosphi; /* sin and cos value */
7670
7688
  var dlon; /* delta longitude value */
7671
7689
  var coslon; /* cos of longitude */
@@ -7703,7 +7721,7 @@
7703
7721
  return p;
7704
7722
  }
7705
7723
 
7706
- function inverse$i(p) {
7724
+ function inverse$j(p) {
7707
7725
  var rh; /* Rho */
7708
7726
  var sinc, cosc;
7709
7727
  var c;
@@ -7735,12 +7753,12 @@
7735
7753
  return p;
7736
7754
  }
7737
7755
 
7738
- var names$j = ['gnom'];
7756
+ var names$k = ['gnom'];
7739
7757
  var gnom = {
7740
- init: init$j,
7741
- forward: forward$i,
7742
- inverse: inverse$i,
7743
- names: names$j
7758
+ init: init$k,
7759
+ forward: forward$j,
7760
+ inverse: inverse$j,
7761
+ names: names$k
7744
7762
  };
7745
7763
 
7746
7764
  function iqsfnz (eccent, q) {
@@ -7785,7 +7803,7 @@
7785
7803
  USGS Open File Report 90-284and Release 4 Interim Reports (2003)
7786
7804
  @this {import('../defs.js').ProjectionDefinition & LocalThis}
7787
7805
  */
7788
- function init$i() {
7806
+ function init$j() {
7789
7807
  // no-op
7790
7808
  if (!this.sphere) {
7791
7809
  this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
@@ -7794,7 +7812,7 @@
7794
7812
 
7795
7813
  /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
7796
7814
  ------------------------------------------------------------ */
7797
- function forward$h(p) {
7815
+ function forward$i(p) {
7798
7816
  var lon = p.x;
7799
7817
  var lat = p.y;
7800
7818
  var x, y;
@@ -7817,7 +7835,7 @@
7817
7835
 
7818
7836
  /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
7819
7837
  ------------------------------------------------------------ */
7820
- function inverse$h(p) {
7838
+ function inverse$i(p) {
7821
7839
  p.x -= this.x0;
7822
7840
  p.y -= this.y0;
7823
7841
  var lon, lat;
@@ -7835,15 +7853,15 @@
7835
7853
  return p;
7836
7854
  }
7837
7855
 
7838
- var names$i = ['cea'];
7856
+ var names$j = ['cea'];
7839
7857
  var cea = {
7840
- init: init$i,
7841
- forward: forward$h,
7842
- inverse: inverse$h,
7843
- names: names$i
7858
+ init: init$j,
7859
+ forward: forward$i,
7860
+ inverse: inverse$i,
7861
+ names: names$j
7844
7862
  };
7845
7863
 
7846
- function init$h() {
7864
+ function init$i() {
7847
7865
  this.x0 = this.x0 || 0;
7848
7866
  this.y0 = this.y0 || 0;
7849
7867
  this.lat0 = this.lat0 || 0;
@@ -7856,7 +7874,7 @@
7856
7874
 
7857
7875
  // forward equations--mapping lat,long to x,y
7858
7876
  // -----------------------------------------------------------------
7859
- function forward$g(p) {
7877
+ function forward$h(p) {
7860
7878
  var lon = p.x;
7861
7879
  var lat = p.y;
7862
7880
 
@@ -7869,7 +7887,7 @@
7869
7887
 
7870
7888
  // inverse equations--mapping x,y to lat/long
7871
7889
  // -----------------------------------------------------------------
7872
- function inverse$g(p) {
7890
+ function inverse$h(p) {
7873
7891
  var x = p.x;
7874
7892
  var y = p.y;
7875
7893
 
@@ -7878,12 +7896,12 @@
7878
7896
  return p;
7879
7897
  }
7880
7898
 
7881
- var names$h = ['Equirectangular', 'Equidistant_Cylindrical', 'Equidistant_Cylindrical_Spherical', 'eqc'];
7899
+ var names$i = ['Equirectangular', 'Equidistant_Cylindrical', 'Equidistant_Cylindrical_Spherical', 'eqc'];
7882
7900
  var eqc = {
7883
- init: init$h,
7884
- forward: forward$g,
7885
- inverse: inverse$g,
7886
- names: names$h
7901
+ init: init$i,
7902
+ forward: forward$h,
7903
+ inverse: inverse$h,
7904
+ names: names$i
7887
7905
  };
7888
7906
 
7889
7907
  /**
@@ -7901,7 +7919,7 @@
7901
7919
  var MAX_ITER$1 = 20;
7902
7920
 
7903
7921
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
7904
- function init$g() {
7922
+ function init$h() {
7905
7923
  /* Place parameters in static storage for common use
7906
7924
  ------------------------------------------------- */
7907
7925
  this.temp = this.b / this.a;
@@ -7916,7 +7934,7 @@
7916
7934
 
7917
7935
  /* Polyconic forward equations--mapping lat,long to x,y
7918
7936
  --------------------------------------------------- */
7919
- function forward$f(p) {
7937
+ function forward$g(p) {
7920
7938
  var lon = p.x;
7921
7939
  var lat = p.y;
7922
7940
  var x, y, el;
@@ -7947,7 +7965,7 @@
7947
7965
 
7948
7966
  /* Inverse equations
7949
7967
  ----------------- */
7950
- function inverse$f(p) {
7968
+ function inverse$g(p) {
7951
7969
  var lon, lat, x, y, i;
7952
7970
  var al, bl;
7953
7971
  var phi, dphi;
@@ -8009,15 +8027,15 @@
8009
8027
  return p;
8010
8028
  }
8011
8029
 
8012
- var names$g = ['Polyconic', 'American_Polyconic', 'poly'];
8030
+ var names$h = ['Polyconic', 'American_Polyconic', 'poly'];
8013
8031
  var poly = {
8014
- init: init$g,
8015
- forward: forward$f,
8016
- inverse: inverse$f,
8017
- names: names$g
8032
+ init: init$h,
8033
+ forward: forward$g,
8034
+ inverse: inverse$g,
8035
+ names: names$h
8018
8036
  };
8019
8037
 
8020
- function init$f() {
8038
+ function init$g() {
8021
8039
  this.A = [];
8022
8040
  this.A[1] = 0.6399175073;
8023
8041
  this.A[2] = -0.1358797613;
@@ -8076,7 +8094,7 @@
8076
8094
  New Zealand Map Grid Forward - long/lat to x/y
8077
8095
  long/lat in radians
8078
8096
  */
8079
- function forward$e(p) {
8097
+ function forward$f(p) {
8080
8098
  var n;
8081
8099
  var lon = p.x;
8082
8100
  var lat = p.y;
@@ -8127,7 +8145,7 @@
8127
8145
  /**
8128
8146
  New Zealand Map Grid Inverse - x/y to long/lat
8129
8147
  */
8130
- function inverse$e(p) {
8148
+ function inverse$f(p) {
8131
8149
  var n;
8132
8150
  var x = p.x;
8133
8151
  var y = p.y;
@@ -8218,12 +8236,12 @@
8218
8236
  return p;
8219
8237
  }
8220
8238
 
8221
- var names$f = ['New_Zealand_Map_Grid', 'nzmg'];
8239
+ var names$g = ['New_Zealand_Map_Grid', 'nzmg'];
8222
8240
  var nzmg = {
8223
- init: init$f,
8224
- forward: forward$e,
8225
- inverse: inverse$e,
8226
- names: names$f
8241
+ init: init$g,
8242
+ forward: forward$f,
8243
+ inverse: inverse$f,
8244
+ names: names$g
8227
8245
  };
8228
8246
 
8229
8247
  /*
@@ -8234,13 +8252,13 @@
8234
8252
 
8235
8253
  /* Initialize the Miller Cylindrical projection
8236
8254
  ------------------------------------------- */
8237
- function init$e() {
8255
+ function init$f() {
8238
8256
  // no-op
8239
8257
  }
8240
8258
 
8241
8259
  /* Miller Cylindrical forward equations--mapping lat,long to x,y
8242
8260
  ------------------------------------------------------------ */
8243
- function forward$d(p) {
8261
+ function forward$e(p) {
8244
8262
  var lon = p.x;
8245
8263
  var lat = p.y;
8246
8264
  /* Forward equations
@@ -8256,7 +8274,7 @@
8256
8274
 
8257
8275
  /* Miller Cylindrical inverse equations--mapping x,y to lat/long
8258
8276
  ------------------------------------------------------------ */
8259
- function inverse$d(p) {
8277
+ function inverse$e(p) {
8260
8278
  p.x -= this.x0;
8261
8279
  p.y -= this.y0;
8262
8280
 
@@ -8268,12 +8286,12 @@
8268
8286
  return p;
8269
8287
  }
8270
8288
 
8271
- var names$e = ['Miller_Cylindrical', 'mill'];
8289
+ var names$f = ['Miller_Cylindrical', 'mill'];
8272
8290
  var mill = {
8273
- init: init$e,
8274
- forward: forward$d,
8275
- inverse: inverse$d,
8276
- names: names$e
8291
+ init: init$f,
8292
+ forward: forward$e,
8293
+ inverse: inverse$e,
8294
+ names: names$f
8277
8295
  };
8278
8296
 
8279
8297
  var MAX_ITER = 20;
@@ -8289,7 +8307,7 @@
8289
8307
  */
8290
8308
 
8291
8309
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
8292
- function init$d() {
8310
+ function init$e() {
8293
8311
  /* Place parameters in static storage for common use
8294
8312
  ------------------------------------------------- */
8295
8313
  this.long0 = this.long0 || 0;
@@ -8307,7 +8325,7 @@
8307
8325
 
8308
8326
  /* Sinusoidal forward equations--mapping lat,long to x,y
8309
8327
  ----------------------------------------------------- */
8310
- function forward$c(p) {
8328
+ function forward$d(p) {
8311
8329
  var x, y;
8312
8330
  var lon = p.x;
8313
8331
  var lat = p.y;
@@ -8342,7 +8360,7 @@
8342
8360
  return p;
8343
8361
  }
8344
8362
 
8345
- function inverse$c(p) {
8363
+ function inverse$d(p) {
8346
8364
  var lat, temp, lon, s;
8347
8365
 
8348
8366
  p.x -= this.x0;
@@ -8377,8 +8395,45 @@
8377
8395
  return p;
8378
8396
  }
8379
8397
 
8380
- var names$d = ['Sinusoidal', 'sinu'];
8398
+ var names$e = ['Sinusoidal', 'sinu'];
8381
8399
  var sinu = {
8400
+ init: init$e,
8401
+ forward: forward$d,
8402
+ inverse: inverse$d,
8403
+ names: names$e
8404
+ };
8405
+
8406
+ /**
8407
+ * Eckert VI projection — spherical sinusoidal variant with m=1, n=1+π/2.
8408
+ * Always forces spherical computation regardless of the ellipsoid.
8409
+ *
8410
+ * @typedef {Object} LocalThis
8411
+ * @property {number} m
8412
+ * @property {number} n
8413
+ * @property {number} C_y
8414
+ * @property {number} C_x
8415
+ * @property {number} es
8416
+ */
8417
+
8418
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
8419
+ function init$d() {
8420
+ /* Force spherical handling */
8421
+ this.sphere = true;
8422
+ this.b = this.a;
8423
+
8424
+ this.m = 1.0;
8425
+ this.n = 2.570796326794896619231321691; /* 1 + π/2 */
8426
+ this.es = 0;
8427
+
8428
+ this.C_y = Math.sqrt((this.m + 1.0) / this.n);
8429
+ this.C_x = this.C_y / (this.m + 1.0);
8430
+ }
8431
+
8432
+ var forward$c = forward$d;
8433
+ var inverse$c = inverse$d;
8434
+
8435
+ var names$d = ['Eckert_VI', 'eck6'];
8436
+ var eck6 = {
8382
8437
  init: init$d,
8383
8438
  forward: forward$c,
8384
8439
  inverse: inverse$c,
@@ -10055,32 +10110,62 @@
10055
10110
  A4 = 0.003796,
10056
10111
  M = Math.sqrt(3) / 2.0;
10057
10112
 
10113
+ /**
10114
+ * @typedef {Object} LocalThis
10115
+ * @property {number} es
10116
+ * @property {number} e
10117
+ * @property {Array<number>} apa
10118
+ * @property {number} qp
10119
+ * @property {number} rqda
10120
+ */
10121
+
10122
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
10058
10123
  function init$2() {
10059
- this.es = 0;
10060
10124
  this.long0 = this.long0 !== undefined ? this.long0 : 0;
10061
10125
  this.x0 = this.x0 !== undefined ? this.x0 : 0;
10062
10126
  this.y0 = this.y0 !== undefined ? this.y0 : 0;
10127
+ if (this.es !== 0) {
10128
+ this.apa = authset(this.es);
10129
+ this.qp = qsfnz(this.e, 1);
10130
+ this.rqda = Math.sqrt(0.5 * this.qp);
10131
+ }
10063
10132
  }
10064
10133
 
10134
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
10065
10135
  function forward$1(p) {
10066
10136
  var lam = adjust_lon(p.x - this.long0, this.over);
10067
10137
  var phi = p.y;
10068
- var paramLat = Math.asin(M * Math.sin(phi)),
10138
+ var sinphi = Math.sin(phi);
10139
+ if (this.es !== 0) {
10140
+ sinphi = qsfnz(this.e, sinphi) / this.qp;
10141
+ }
10142
+ var paramLat = Math.asin(M * sinphi),
10069
10143
  paramLatSq = paramLat * paramLat,
10070
10144
  paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;
10071
10145
  p.x = lam * Math.cos(paramLat)
10072
10146
  / (M * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)));
10073
10147
  p.y = paramLat * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq));
10074
10148
 
10149
+ if (this.es !== 0) {
10150
+ p.x *= this.rqda;
10151
+ p.y *= this.rqda;
10152
+ }
10153
+
10075
10154
  p.x = this.a * p.x + this.x0;
10076
10155
  p.y = this.a * p.y + this.y0;
10077
10156
  return p;
10078
10157
  }
10079
10158
 
10159
+ /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
10080
10160
  function inverse$1(p) {
10081
10161
  p.x = (p.x - this.x0) / this.a;
10082
10162
  p.y = (p.y - this.y0) / this.a;
10083
10163
 
10164
+ if (this.es !== 0) {
10165
+ p.x /= this.rqda;
10166
+ p.y /= this.rqda;
10167
+ }
10168
+
10084
10169
  var EPS = 1e-9,
10085
10170
  NITER = 12,
10086
10171
  paramLat = p.y,
@@ -10102,6 +10187,10 @@
10102
10187
  / Math.cos(paramLat);
10103
10188
  p.y = Math.asin(Math.sin(paramLat) / M);
10104
10189
 
10190
+ if (this.es !== 0) {
10191
+ p.y = authlat(p.y, this.apa);
10192
+ }
10193
+
10105
10194
  p.x = adjust_lon(p.x + this.long0, this.over);
10106
10195
  return p;
10107
10196
  }
@@ -10319,7 +10408,7 @@
10319
10408
  this.y0 = this.y0 || 0;
10320
10409
  this.long0 = this.long0 || 0;
10321
10410
  this.title = this.title || 'General Oblique Transformation';
10322
- this.isIdentity = names$x.includes(this.o_proj);
10411
+ this.isIdentity = names$y.includes(this.o_proj);
10323
10412
 
10324
10413
  /** Verify required parameters exist */
10325
10414
  if (!this.o_proj) {
@@ -10476,7 +10565,7 @@
10476
10565
  */
10477
10566
  function forwardOblique(self, lp) {
10478
10567
  let { x: lam, y: phi } = lp;
10479
- lam += self.long0;
10568
+ lam = adjust_lon(lam - self.long0, self.over);
10480
10569
  const coslam = Math.cos(lam);
10481
10570
  const sinphi = Math.sin(phi);
10482
10571
  const cosphi = Math.cos(phi);
@@ -10506,7 +10595,7 @@
10506
10595
  */
10507
10596
  function forwardTransverse(self, lp) {
10508
10597
  let { x: lam, y: phi } = lp;
10509
- lam += self.long0;
10598
+ lam = adjust_lon(lam - self.long0, self.over);
10510
10599
  const cosphi = Math.cos(phi);
10511
10600
  const coslam = Math.cos(lam);
10512
10601
  lp.x = adjust_lon(
@@ -10616,6 +10705,7 @@
10616
10705
  proj4.Proj.projections.add(nzmg);
10617
10706
  proj4.Proj.projections.add(mill);
10618
10707
  proj4.Proj.projections.add(sinu);
10708
+ proj4.Proj.projections.add(eck6);
10619
10709
  proj4.Proj.projections.add(moll);
10620
10710
  proj4.Proj.projections.add(eqdc);
10621
10711
  proj4.Proj.projections.add(vandg);
@@ -10660,7 +10750,7 @@
10660
10750
  nadgrid,
10661
10751
  transform,
10662
10752
  mgrs,
10663
- version: '2.20.8'
10753
+ version: '2.20.9'
10664
10754
  });
10665
10755
  includedProjections(proj4);
10666
10756