proj4 2.20.6 → 2.20.7

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 (115) hide show
  1. package/PUBLISHING.md +24 -12
  2. package/README.md +9 -11
  3. package/SECURITY.md +23 -0
  4. package/changelog.md +4 -2
  5. package/dist/proj4-src.js +1 -1
  6. package/dist/proj4.js +1 -1
  7. package/eslint.config.mjs +1 -3
  8. package/package.json +14 -16
  9. package/tsconfig.json +3 -0
  10. package/vitest.config.mjs +14 -0
  11. package/Gruntfile.js +0 -65
  12. package/bower.json +0 -24
  13. package/component.json +0 -17
  14. package/dist/lib/Point.d.ts +0 -24
  15. package/dist/lib/Proj.d.ts +0 -75
  16. package/dist/lib/adjust_axis.d.ts +0 -1
  17. package/dist/lib/checkSanity.d.ts +0 -1
  18. package/dist/lib/common/acosh.d.ts +0 -1
  19. package/dist/lib/common/adjust_lat.d.ts +0 -1
  20. package/dist/lib/common/adjust_lon.d.ts +0 -1
  21. package/dist/lib/common/adjust_zone.d.ts +0 -1
  22. package/dist/lib/common/asinh.d.ts +0 -1
  23. package/dist/lib/common/asinhy.d.ts +0 -1
  24. package/dist/lib/common/asinz.d.ts +0 -1
  25. package/dist/lib/common/atanh.d.ts +0 -1
  26. package/dist/lib/common/clens.d.ts +0 -1
  27. package/dist/lib/common/clens_cmplx.d.ts +0 -1
  28. package/dist/lib/common/cosh.d.ts +0 -1
  29. package/dist/lib/common/e0fn.d.ts +0 -1
  30. package/dist/lib/common/e1fn.d.ts +0 -1
  31. package/dist/lib/common/e2fn.d.ts +0 -1
  32. package/dist/lib/common/e3fn.d.ts +0 -1
  33. package/dist/lib/common/fL.d.ts +0 -1
  34. package/dist/lib/common/gN.d.ts +0 -1
  35. package/dist/lib/common/gatg.d.ts +0 -1
  36. package/dist/lib/common/hypot.d.ts +0 -1
  37. package/dist/lib/common/imlfn.d.ts +0 -1
  38. package/dist/lib/common/invlatiso.d.ts +0 -1
  39. package/dist/lib/common/iqsfnz.d.ts +0 -1
  40. package/dist/lib/common/latiso.d.ts +0 -1
  41. package/dist/lib/common/log1py.d.ts +0 -1
  42. package/dist/lib/common/mlfn.d.ts +0 -1
  43. package/dist/lib/common/msfnz.d.ts +0 -1
  44. package/dist/lib/common/phi2z.d.ts +0 -1
  45. package/dist/lib/common/pj_enfn.d.ts +0 -1
  46. package/dist/lib/common/pj_inv_mlfn.d.ts +0 -1
  47. package/dist/lib/common/pj_mlfn.d.ts +0 -1
  48. package/dist/lib/common/qsfnz.d.ts +0 -1
  49. package/dist/lib/common/sign.d.ts +0 -1
  50. package/dist/lib/common/sinh.d.ts +0 -1
  51. package/dist/lib/common/srat.d.ts +0 -1
  52. package/dist/lib/common/tanh.d.ts +0 -1
  53. package/dist/lib/common/toPoint.d.ts +0 -5
  54. package/dist/lib/common/tsfnz.d.ts +0 -1
  55. package/dist/lib/common/vincenty.d.ts +0 -35
  56. package/dist/lib/constants/Datum.d.ts +0 -1823
  57. package/dist/lib/constants/Ellipsoid.d.ts +0 -353
  58. package/dist/lib/constants/PrimeMeridian.d.ts +0 -16
  59. package/dist/lib/constants/units.d.ts +0 -63
  60. package/dist/lib/constants/values.d.ts +0 -19
  61. package/dist/lib/core.d.ts +0 -119
  62. package/dist/lib/datum.d.ts +0 -10
  63. package/dist/lib/datumUtils.d.ts +0 -28
  64. package/dist/lib/datum_transform.d.ts +0 -2
  65. package/dist/lib/defs.d.ts +0 -59
  66. package/dist/lib/deriveConstants.d.ts +0 -11
  67. package/dist/lib/extend.d.ts +0 -1
  68. package/dist/lib/global.d.ts +0 -1
  69. package/dist/lib/includedProjections.d.ts +0 -1
  70. package/dist/lib/index.d.ts +0 -47
  71. package/dist/lib/match.d.ts +0 -1
  72. package/dist/lib/nadgrid.d.ts +0 -141
  73. package/dist/lib/parseCode.d.ts +0 -6
  74. package/dist/lib/projString.d.ts +0 -5
  75. package/dist/lib/projections/aea.d.ts +0 -83
  76. package/dist/lib/projections/aeqd.d.ts +0 -32
  77. package/dist/lib/projections/bonne.d.ts +0 -27
  78. package/dist/lib/projections/cass.d.ts +0 -36
  79. package/dist/lib/projections/cea.d.ts +0 -28
  80. package/dist/lib/projections/eqc.d.ts +0 -20
  81. package/dist/lib/projections/eqdc.d.ts +0 -71
  82. package/dist/lib/projections/eqearth.d.ts +0 -17
  83. package/dist/lib/projections/equi.d.ts +0 -40
  84. package/dist/lib/projections/etmerc.d.ts +0 -45
  85. package/dist/lib/projections/gauss.d.ts +0 -38
  86. package/dist/lib/projections/geocent.d.ts +0 -22
  87. package/dist/lib/projections/geos.d.ts +0 -51
  88. package/dist/lib/projections/gnom.d.ts +0 -37
  89. package/dist/lib/projections/gstmerc.d.ts +0 -41
  90. package/dist/lib/projections/krovak.d.ts +0 -34
  91. package/dist/lib/projections/laea.d.ts +0 -70
  92. package/dist/lib/projections/lcc.d.ts +0 -36
  93. package/dist/lib/projections/longlat.d.ts +0 -11
  94. package/dist/lib/projections/merc.d.ts +0 -30
  95. package/dist/lib/projections/mill.d.ts +0 -11
  96. package/dist/lib/projections/moll.d.ts +0 -17
  97. package/dist/lib/projections/nzmg.d.ts +0 -33
  98. package/dist/lib/projections/ob_tran.d.ts +0 -80
  99. package/dist/lib/projections/omerc.d.ts +0 -60
  100. package/dist/lib/projections/ortho.d.ts +0 -25
  101. package/dist/lib/projections/poly.d.ts +0 -32
  102. package/dist/lib/projections/qsc.d.ts +0 -31
  103. package/dist/lib/projections/robin.d.ts +0 -24
  104. package/dist/lib/projections/sinu.d.ts +0 -38
  105. package/dist/lib/projections/somerc.d.ts +0 -35
  106. package/dist/lib/projections/stere.d.ts +0 -52
  107. package/dist/lib/projections/sterea.d.ts +0 -33
  108. package/dist/lib/projections/tmerc.d.ts +0 -38
  109. package/dist/lib/projections/tpers.d.ts +0 -45
  110. package/dist/lib/projections/utm.d.ts +0 -19
  111. package/dist/lib/projections/vandg.d.ts +0 -28
  112. package/dist/lib/projections.d.ts +0 -19
  113. package/dist/lib/transform.d.ts +0 -8
  114. package/dist/projs.d.ts +0 -1
  115. package/index.d.ts +0 -6
package/eslint.config.mjs CHANGED
@@ -32,9 +32,7 @@ export default [
32
32
  languageOptions: {
33
33
  globals: {
34
34
  ...globals.browser,
35
- ...globals.node,
36
- ...globals.mocha,
37
- ...globals.amd
35
+ ...globals.node
38
36
  }
39
37
  }
40
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proj4",
3
- "version": "2.20.6",
3
+ "version": "2.20.7",
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",
@@ -8,18 +8,18 @@
8
8
  "types": "dist/index.d.ts",
9
9
  "funding": "https://github.com/sponsors/ahocevar",
10
10
  "scripts": {
11
- "prepare": "npm run test",
12
- "build": "grunt && npm run rollup",
13
- "build:tmerc": "grunt build:tmerc && npm run rollup",
11
+ "prepare": "npm run build",
12
+ "build": "node scripts/build.mjs && npm run rollup",
13
+ "build:custom": "node scripts/build.mjs",
14
14
  "rollup": "rollup -c",
15
15
  "pretest": "npm run lint && npm run types",
16
16
  "lint": "eslint *.js *.mjs scripts lib test",
17
17
  "format": "npm run lint -- --fix",
18
18
  "test": "npm run build && npm run test:all",
19
- "test:coverage": "nyc npm run test:ci",
20
- "test:all": "npm run test:ci && npm run test:browser",
21
- "test:browser": "node test/puppeteer-tests.mjs",
22
- "test:ci": "npx -y mocha test/test-ci.mjs --reporter dot",
19
+ "test:coverage": "vitest run --coverage",
20
+ "test:all": "npm run test:node && npm run test:browser",
21
+ "test:node": "vitest run",
22
+ "test:browser": "vitest run --browser.enabled",
23
23
  "types": "tsc"
24
24
  },
25
25
  "repository": {
@@ -33,18 +33,16 @@
33
33
  "@rollup/plugin-json": "^6.1.0",
34
34
  "@rollup/plugin-node-resolve": "^15.2.3",
35
35
  "@rollup/plugin-replace": "^5.0.5",
36
- "@rollup/plugin-terser": "^0.4.4",
36
+ "@rollup/plugin-terser": "^1.0.0",
37
37
  "@stylistic/eslint-plugin": "^4.2.0",
38
- "chai": "^5.0.0",
38
+ "@vitest/browser": "^4.1.2",
39
+ "@vitest/browser-playwright": "^4.1.2",
40
+ "@vitest/coverage-v8": "^4.1.2",
39
41
  "eslint": "^9.25.1",
40
42
  "geotiff": "^2.1.4-beta.0",
41
- "grunt": "^1.6.1",
42
- "grunt-cli": "^1.4.3",
43
- "mocha": "^10.2.0",
44
- "nyc": "^17.1.0",
45
- "puppeteer": "^24.2.0",
46
43
  "rollup": "^4.9.6",
47
- "typescript": "^5.8.3"
44
+ "typescript": "^5.8.3",
45
+ "vitest": "^4.1.2"
48
46
  },
49
47
  "dependencies": {
50
48
  "mgrs": "1.0.0",
package/tsconfig.json CHANGED
@@ -6,6 +6,9 @@
6
6
  "emitDeclarationOnly": true,
7
7
  "declaration": true,
8
8
  "declarationDir": "dist",
9
+ "lib": [
10
+ "es2020", "dom"
11
+ ]
9
12
  },
10
13
  "include": [
11
14
  "lib/**/*.js",
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import { playwright } from '@vitest/browser-playwright';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ include: ['test/**/*.test.{js,mjs}'],
7
+ browser: {
8
+ enabled: false,
9
+ headless: true,
10
+ provider: playwright(),
11
+ instances: [{ browser: 'chromium' }]
12
+ }
13
+ }
14
+ });
package/Gruntfile.js DELETED
@@ -1,65 +0,0 @@
1
- var projs = [
2
- 'tmerc',
3
- 'etmerc',
4
- 'utm',
5
- 'sterea',
6
- 'stere',
7
- 'somerc',
8
- 'omerc',
9
- 'lcc',
10
- 'krovak',
11
- 'cass',
12
- 'laea',
13
- 'aea',
14
- 'gnom',
15
- 'cea',
16
- 'eqc',
17
- 'poly',
18
- 'nzmg',
19
- 'mill',
20
- 'sinu',
21
- 'moll',
22
- 'eqdc',
23
- 'vandg',
24
- 'aeqd',
25
- 'ortho',
26
- 'qsc',
27
- 'robin',
28
- 'geocent',
29
- 'tpers',
30
- 'geos',
31
- 'eqearth',
32
- 'bonne',
33
- 'ob_tran'
34
- ];
35
- module.exports = function (grunt) {
36
- grunt.initConfig({
37
- pkg: grunt.file.readJSON('package.json')
38
- });
39
-
40
- grunt.registerTask('custom', function () {
41
- var projections = this.args;
42
- if (projections[0] === 'default') {
43
- grunt.file.write('./projs.js', 'export default function(){}');
44
- return;
45
- }
46
- if (projections[0] === 'all') {
47
- projections = projs;
48
- }
49
- grunt.file.write('./projs.js', [
50
- projections.map(function (proj) {
51
- return 'import ' + proj + ' from \'./lib/projections/' + proj + '\';';
52
- }).join('\n'),
53
- 'export default function (proj4) {',
54
- projections.map(function (proj) {
55
- return ' proj4.Proj.projections.add(' + proj + ');';
56
- }).join('\n'),
57
- '}', ''
58
- ].join('\n'));
59
- });
60
- grunt.registerTask('build', function () {
61
- var args = this.args.length ? this.args[0].split(',') : ['default'];
62
- grunt.task.run('custom:' + args.join(':'));
63
- });
64
- grunt.registerTask('default', ['build:all']);
65
- };
package/bower.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "name": "proj4",
3
- "version": "2.20.6",
4
- "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
5
- "homepage": "https://github.com/proj4js/proj4js",
6
- "main": "dist/proj4.js",
7
- "keywords": [
8
- "gis",
9
- "projections",
10
- "geospatial",
11
- "transform",
12
- "datum"
13
- ],
14
- "license": "MIT",
15
- "ignore": [
16
- "**/.*",
17
- "node_modules",
18
- "bower_components",
19
- "test",
20
- "tests",
21
- "almond",
22
- "src"
23
- ]
24
- }
package/component.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "name": "proj4",
3
- "version": "2.20.6",
4
- "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
5
- "repo": "proj4js/proj4js",
6
- "keywords": [
7
- "projections",
8
- "proj4",
9
- "transform",
10
- "crs"
11
- ],
12
- "license": "MIT",
13
- "main": "dist/proj4.js",
14
- "scripts": [
15
- "dist/proj4.js"
16
- ]
17
- }
@@ -1,24 +0,0 @@
1
- export default Point;
2
- /**
3
- * @deprecated v3.0.0 - use proj4.toPoint instead
4
- * @param {number | import('./core').TemplateCoordinates | string} x
5
- * @param {number} [y]
6
- * @param {number} [z]
7
- */
8
- declare function Point(x: number | import("./core").TemplateCoordinates | string, y?: number, z?: number): Point;
9
- declare class Point {
10
- /**
11
- * @deprecated v3.0.0 - use proj4.toPoint instead
12
- * @param {number | import('./core').TemplateCoordinates | string} x
13
- * @param {number} [y]
14
- * @param {number} [z]
15
- */
16
- constructor(x: number | import("./core").TemplateCoordinates | string, y?: number, z?: number);
17
- x: string | number;
18
- y: number;
19
- z: number;
20
- toMGRS(accuracy: any): any;
21
- }
22
- declare namespace Point {
23
- function fromMGRS(mgrsStr: any): Point;
24
- }
@@ -1,75 +0,0 @@
1
- export default Projection;
2
- export type DatumDefinition = {
3
- /**
4
- * - The type of datum.
5
- */
6
- datum_type: number;
7
- /**
8
- * - Semi-major axis of the ellipsoid.
9
- */
10
- a: number;
11
- /**
12
- * - Semi-minor axis of the ellipsoid.
13
- */
14
- b: number;
15
- /**
16
- * - Eccentricity squared of the ellipsoid.
17
- */
18
- es: number;
19
- /**
20
- * - Second eccentricity squared of the ellipsoid.
21
- */
22
- ep2: number;
23
- };
24
- /**
25
- * @typedef {Object} DatumDefinition
26
- * @property {number} datum_type - The type of datum.
27
- * @property {number} a - Semi-major axis of the ellipsoid.
28
- * @property {number} b - Semi-minor axis of the ellipsoid.
29
- * @property {number} es - Eccentricity squared of the ellipsoid.
30
- * @property {number} ep2 - Second eccentricity squared of the ellipsoid.
31
- */
32
- /**
33
- * @param {string | import('./core').PROJJSONDefinition | import('./defs').ProjectionDefinition} srsCode
34
- * @param {(errorMessage?: string, instance?: Projection) => void} [callback]
35
- */
36
- declare function Projection(srsCode: string | import("./core").PROJJSONDefinition | import("./defs").ProjectionDefinition, callback?: (errorMessage?: string, instance?: Projection) => void): Projection;
37
- declare class Projection {
38
- /**
39
- * @typedef {Object} DatumDefinition
40
- * @property {number} datum_type - The type of datum.
41
- * @property {number} a - Semi-major axis of the ellipsoid.
42
- * @property {number} b - Semi-minor axis of the ellipsoid.
43
- * @property {number} es - Eccentricity squared of the ellipsoid.
44
- * @property {number} ep2 - Second eccentricity squared of the ellipsoid.
45
- */
46
- /**
47
- * @param {string | import('./core').PROJJSONDefinition | import('./defs').ProjectionDefinition} srsCode
48
- * @param {(errorMessage?: string, instance?: Projection) => void} [callback]
49
- */
50
- constructor(srsCode: string | import("./core").PROJJSONDefinition | import("./defs").ProjectionDefinition, callback?: (errorMessage?: string, instance?: Projection) => void);
51
- /** @type {<T extends import('./core').TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} */
52
- forward: <T extends import("./core").TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T;
53
- /** @type {<T extends import('./core').TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} */
54
- inverse: <T extends import("./core").TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T;
55
- /** @type {function(): void} */
56
- init: () => void;
57
- /** @type {string} */
58
- name: string;
59
- /** @type {Array<string>} */
60
- names: Array<string>;
61
- /** @type {string} */
62
- title: string;
63
- a: any;
64
- b: any;
65
- rf: any;
66
- sphere: any;
67
- es: number;
68
- e: number;
69
- ep2: number;
70
- datum: DatumDefinition;
71
- }
72
- declare namespace Projection {
73
- export { projections };
74
- }
75
- import projections from './projections';
@@ -1 +0,0 @@
1
- export default function _default(crs: any, denorm: any, point: any): import("./core").InterfaceCoordinates;
@@ -1 +0,0 @@
1
- export default function _default(point: any): void;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): any;
@@ -1 +0,0 @@
1
- export default function _default(x: any, skipAdjust: any): any;
@@ -1 +0,0 @@
1
- export default function _default(zone: any, lon: any): any;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(pp: any, arg_r: any): number;
@@ -1 +0,0 @@
1
- export default function _default(pp: any, arg_r: any, arg_i: any): number[];
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any, L: any): number;
@@ -1 +0,0 @@
1
- export default function _default(a: any, e: any, sinphi: any): number;
@@ -1 +0,0 @@
1
- export default function _default(pp: any, B: any): any;
@@ -1 +0,0 @@
1
- export default function _default(x: any, y: any): number;
@@ -1 +0,0 @@
1
- export default function _default(ml: any, e0: any, e1: any, e2: any, e3: any): number;
@@ -1 +0,0 @@
1
- export default function _default(eccent: any, ts: any): number;
@@ -1 +0,0 @@
1
- export default function _default(eccent: any, q: any): number;
@@ -1 +0,0 @@
1
- export default function _default(eccent: any, phi: any, sinphi: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): any;
@@ -1 +0,0 @@
1
- export default function _default(e0: any, e1: any, e2: any, e3: any, phi: any): number;
@@ -1 +0,0 @@
1
- export default function _default(eccent: any, sinphi: any, cosphi: any): number;
@@ -1 +0,0 @@
1
- export default function _default(eccent: any, ts: any): number;
@@ -1 +0,0 @@
1
- export default function _default(es: any): number[];
@@ -1 +0,0 @@
1
- export default function _default(arg: any, es: any, en: any): any;
@@ -1 +0,0 @@
1
- export default function _default(phi: any, sphi: any, cphi: any, en: any): number;
@@ -1 +0,0 @@
1
- export default function _default(eccent: any, sinphi: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): 1 | -1;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1 +0,0 @@
1
- export default function _default(esinp: any, exp: any): number;
@@ -1 +0,0 @@
1
- export default function _default(x: any): number;
@@ -1,5 +0,0 @@
1
- /**
2
- * @param {Array<number>} array
3
- * @returns {import("../core").InterfaceCoordinates}
4
- */
5
- export default function _default(array: Array<number>): import("../core").InterfaceCoordinates;
@@ -1 +0,0 @@
1
- export default function _default(eccent: any, phi: any, sinphi: any): number;
@@ -1,35 +0,0 @@
1
- /**
2
- * Calculates the inverse geodesic problem using Vincenty's formulae.
3
- * Computes the forward azimuth and ellipsoidal distance between two points
4
- * specified by latitude and longitude on the surface of an ellipsoid.
5
- *
6
- * @param {number} lat1 Latitude of the first point in radians.
7
- * @param {number} lon1 Longitude of the first point in radians.
8
- * @param {number} lat2 Latitude of the second point in radians.
9
- * @param {number} lon2 Longitude of the second point in radians.
10
- * @param {number} a Semi-major axis of the ellipsoid (meters).
11
- * @param {number} f Flattening of the ellipsoid.
12
- * @returns {{ azi1: number, s12: number }} An object containing:
13
- * - azi1: Forward azimuth from the first point to the second point (radians).
14
- * - s12: Ellipsoidal distance between the two points (meters).
15
- */
16
- export function vincentyInverse(lat1: number, lon1: number, lat2: number, lon2: number, a: number, f: number): {
17
- azi1: number;
18
- s12: number;
19
- };
20
- /**
21
- * Solves the direct geodetic problem using Vincenty's formulae.
22
- * Given a starting point, initial azimuth, and distance, computes the destination point on the ellipsoid.
23
- *
24
- * @param {number} lat1 Latitude of the starting point in radians.
25
- * @param {number} lon1 Longitude of the starting point in radians.
26
- * @param {number} azi1 Initial azimuth (forward azimuth) in radians.
27
- * @param {number} s12 Distance to travel from the starting point in meters.
28
- * @param {number} a Semi-major axis of the ellipsoid in meters.
29
- * @param {number} f Flattening of the ellipsoid.
30
- * @returns {{lat2: number, lon2: number}} The latitude and longitude (in radians) of the destination point.
31
- */
32
- export function vincentyDirect(lat1: number, lon1: number, azi1: number, s12: number, a: number, f: number): {
33
- lat2: number;
34
- lon2: number;
35
- };