proj4 2.16.2 → 2.19.0

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 (166) hide show
  1. package/README.md +12 -0
  2. package/bower.json +1 -1
  3. package/component.json +1 -1
  4. package/dist/lib/Point.d.ts +24 -0
  5. package/dist/lib/Proj.d.ts +71 -0
  6. package/dist/lib/adjust_axis.d.ts +1 -0
  7. package/dist/lib/checkSanity.d.ts +1 -0
  8. package/dist/lib/common/acosh.d.ts +1 -0
  9. package/dist/lib/common/adjust_lat.d.ts +1 -0
  10. package/dist/lib/common/adjust_lon.d.ts +1 -0
  11. package/dist/lib/common/adjust_zone.d.ts +1 -0
  12. package/dist/lib/common/asinh.d.ts +1 -0
  13. package/dist/lib/common/asinhy.d.ts +1 -0
  14. package/dist/lib/common/asinz.d.ts +1 -0
  15. package/dist/lib/common/atanh.d.ts +1 -0
  16. package/dist/lib/common/clens.d.ts +1 -0
  17. package/dist/lib/common/clens_cmplx.d.ts +1 -0
  18. package/dist/lib/common/cosh.d.ts +1 -0
  19. package/dist/lib/common/e0fn.d.ts +1 -0
  20. package/dist/lib/common/e1fn.d.ts +1 -0
  21. package/dist/lib/common/e2fn.d.ts +1 -0
  22. package/dist/lib/common/e3fn.d.ts +1 -0
  23. package/dist/lib/common/fL.d.ts +1 -0
  24. package/dist/lib/common/gN.d.ts +1 -0
  25. package/dist/lib/common/gatg.d.ts +1 -0
  26. package/dist/lib/common/hypot.d.ts +1 -0
  27. package/dist/lib/common/imlfn.d.ts +1 -0
  28. package/dist/lib/common/invlatiso.d.ts +1 -0
  29. package/dist/lib/common/iqsfnz.d.ts +1 -0
  30. package/dist/lib/common/latiso.d.ts +1 -0
  31. package/dist/lib/common/log1py.d.ts +1 -0
  32. package/dist/lib/common/mlfn.d.ts +1 -0
  33. package/dist/lib/common/msfnz.d.ts +1 -0
  34. package/dist/lib/common/phi2z.d.ts +1 -0
  35. package/dist/lib/common/pj_enfn.d.ts +1 -0
  36. package/dist/lib/common/pj_inv_mlfn.d.ts +1 -0
  37. package/dist/lib/common/pj_mlfn.d.ts +1 -0
  38. package/dist/lib/common/qsfnz.d.ts +1 -0
  39. package/dist/lib/common/sign.d.ts +1 -0
  40. package/dist/lib/common/sinh.d.ts +1 -0
  41. package/dist/lib/common/srat.d.ts +1 -0
  42. package/dist/lib/common/tanh.d.ts +1 -0
  43. package/dist/lib/common/toPoint.d.ts +5 -0
  44. package/dist/lib/common/tsfnz.d.ts +1 -0
  45. package/dist/lib/common/vincenty.d.ts +35 -0
  46. package/dist/lib/constants/Datum.d.ts +1715 -0
  47. package/dist/lib/constants/Ellipsoid.d.ts +353 -0
  48. package/dist/lib/constants/PrimeMeridian.d.ts +16 -0
  49. package/dist/lib/constants/units.d.ts +63 -0
  50. package/dist/lib/constants/values.d.ts +19 -0
  51. package/dist/lib/core.d.ts +117 -0
  52. package/dist/lib/datum.d.ts +10 -0
  53. package/dist/lib/datumUtils.d.ts +28 -0
  54. package/dist/lib/datum_transform.d.ts +2 -0
  55. package/dist/lib/defs.d.ts +57 -0
  56. package/dist/lib/deriveConstants.d.ts +11 -0
  57. package/dist/lib/extend.d.ts +1 -0
  58. package/dist/lib/global.d.ts +1 -0
  59. package/dist/lib/includedProjections.d.ts +1 -0
  60. package/dist/lib/index.d.ts +24 -0
  61. package/dist/lib/match.d.ts +1 -0
  62. package/dist/lib/nadgrid.d.ts +107 -0
  63. package/dist/lib/parseCode.d.ts +6 -0
  64. package/dist/lib/projString.d.ts +5 -0
  65. package/dist/lib/projections/aea.d.ts +83 -0
  66. package/dist/lib/projections/aeqd.d.ts +32 -0
  67. package/dist/lib/projections/bonne.d.ts +27 -0
  68. package/dist/lib/projections/cass.d.ts +36 -0
  69. package/dist/lib/projections/cea.d.ts +28 -0
  70. package/dist/lib/projections/eqc.d.ts +20 -0
  71. package/dist/lib/projections/eqdc.d.ts +71 -0
  72. package/dist/lib/projections/eqearth.d.ts +15 -0
  73. package/dist/lib/projections/equi.d.ts +40 -0
  74. package/dist/lib/projections/etmerc.d.ts +45 -0
  75. package/dist/lib/projections/gauss.d.ts +38 -0
  76. package/dist/lib/projections/geocent.d.ts +22 -0
  77. package/dist/lib/projections/geos.d.ts +51 -0
  78. package/dist/lib/projections/gnom.d.ts +37 -0
  79. package/dist/lib/projections/gstmerc.d.ts +41 -0
  80. package/dist/lib/projections/krovak.d.ts +34 -0
  81. package/dist/lib/projections/laea.d.ts +70 -0
  82. package/dist/lib/projections/lcc.d.ts +36 -0
  83. package/dist/lib/projections/longlat.d.ts +11 -0
  84. package/dist/lib/projections/merc.d.ts +30 -0
  85. package/dist/lib/projections/mill.d.ts +11 -0
  86. package/dist/lib/projections/moll.d.ts +11 -0
  87. package/dist/lib/projections/nzmg.d.ts +33 -0
  88. package/dist/lib/projections/omerc.d.ts +60 -0
  89. package/dist/lib/projections/ortho.d.ts +25 -0
  90. package/dist/lib/projections/poly.d.ts +32 -0
  91. package/dist/lib/projections/qsc.d.ts +31 -0
  92. package/dist/lib/projections/robin.d.ts +24 -0
  93. package/dist/lib/projections/sinu.d.ts +37 -0
  94. package/dist/lib/projections/somerc.d.ts +35 -0
  95. package/dist/lib/projections/stere.d.ts +52 -0
  96. package/dist/lib/projections/sterea.d.ts +33 -0
  97. package/dist/lib/projections/tmerc.d.ts +38 -0
  98. package/dist/lib/projections/tpers.d.ts +45 -0
  99. package/dist/lib/projections/utm.d.ts +19 -0
  100. package/dist/lib/projections/vandg.d.ts +28 -0
  101. package/dist/lib/projections.d.ts +10 -0
  102. package/dist/lib/transform.d.ts +8 -0
  103. package/dist/proj4-src.js +908 -249
  104. package/dist/proj4.js +1 -1
  105. package/dist/projs.d.ts +1 -0
  106. package/lib/Point.js +9 -3
  107. package/lib/Proj.js +25 -1
  108. package/lib/adjust_axis.js +1 -0
  109. package/lib/common/toPoint.js +4 -0
  110. package/lib/common/vincenty.js +123 -0
  111. package/lib/constants/PrimeMeridian.js +16 -15
  112. package/lib/core.js +152 -16
  113. package/lib/defs.js +65 -5
  114. package/lib/index.js +17 -11
  115. package/lib/nadgrid.js +132 -2
  116. package/lib/parseCode.js +5 -1
  117. package/lib/projString.js +6 -0
  118. package/lib/projections/aea.js +25 -0
  119. package/lib/projections/aeqd.js +22 -26
  120. package/lib/projections/bonne.js +11 -0
  121. package/lib/projections/cass.js +11 -0
  122. package/lib/projections/cea.js +7 -1
  123. package/lib/projections/eqdc.js +29 -7
  124. package/lib/projections/equi.js +11 -2
  125. package/lib/projections/etmerc.js +12 -0
  126. package/lib/projections/gauss.js +12 -0
  127. package/lib/projections/geos.js +16 -0
  128. package/lib/projections/gnom.js +11 -2
  129. package/lib/projections/gstmerc.js +12 -0
  130. package/lib/projections/laea.js +30 -11
  131. package/lib/projections/lcc.js +10 -0
  132. package/lib/projections/merc.js +9 -0
  133. package/lib/projections/omerc.js +29 -4
  134. package/lib/projections/ortho.js +7 -0
  135. package/lib/projections/poly.js +14 -0
  136. package/lib/projections/qsc.js +11 -0
  137. package/lib/projections/sinu.js +11 -0
  138. package/lib/projections/somerc.js +10 -0
  139. package/lib/projections/stere.js +16 -2
  140. package/lib/projections/sterea.js +10 -0
  141. package/lib/projections/tmerc.js +8 -0
  142. package/lib/projections/tpers.js +24 -3
  143. package/lib/projections/utm.js +1 -0
  144. package/lib/projections/vandg.js +9 -2
  145. package/lib/transform.js +9 -0
  146. package/package.json +9 -10
  147. package/tsconfig.json +14 -0
  148. package/.github/workflows/build-and-test.yml +0 -69
  149. package/.nyc_output/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +0 -1
  150. package/.nyc_output/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +0 -1
  151. package/.nyc_output/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +0 -1
  152. package/.nyc_output/processinfo/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +0 -1
  153. package/.nyc_output/processinfo/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +0 -1
  154. package/.nyc_output/processinfo/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +0 -1
  155. package/.nyc_output/processinfo/index.json +0 -1
  156. package/scripts/readme.md +0 -10
  157. package/scripts/updateDatums.mjs +0 -119
  158. package/scripts/updateEllipsoids.mjs +0 -70
  159. package/test/BETA2007.gsb +0 -0
  160. package/test/ntv2_0_downsampled.gsb +0 -0
  161. package/test/ntv2_0_downsampled_no_error_columns.gsb +0 -0
  162. package/test/opt.html +0 -28
  163. package/test/puppeteer-tests.mjs +0 -110
  164. package/test/test-ci.mjs +0 -10
  165. package/test/test.js +0 -639
  166. package/test/testData.js +0 -2386
package/README.md CHANGED
@@ -146,6 +146,7 @@ WKT1 definitions can contain a `TOWGS84` parameter. For proj strings, `towgs84`
146
146
 
147
147
  ## Grid Based Datum Adjustments
148
148
 
149
+ ### NTV2 format (.gsb)
149
150
  To use `+nadgrids=` in a proj definition or a WKT2/PROJJSON `ABRIDGEDTRANSFORM` with an `NTv2` method, first read your NTv2 `.gsb` file (e.g. from https://github.com/OSGeo/proj-datumgrid) into an ArrayBuffer, then pass it to `proj4.nadgrid`. E.g:
150
151
 
151
152
  ```javascript
@@ -164,6 +165,17 @@ proj4.nadgrid('key', buffer, {includeErrorFields:false});
164
165
 
165
166
  If the options argument is omitted, `includeErrorFields` is assumed to be true.
166
167
 
168
+
169
+ ### GeoTIFF format (.tif)
170
+ To use `+nadgrids=` in a proj definition or a WKT2/PROJJSON `ABRIDGEDTRANSFORM` with a `GeoTIFF` method, first read your `.tif` file (e.g. from https://github.com/OSGeo/PROJ-data or https://cdn.proj.org/) into a GeoTIFF instance from the [GeoTIFF.js library](https://github.com/geotiffjs/geotiff.js/), then pass it to `proj4.nadgrid`. E.g:
171
+ ```javascript
172
+ import { fromUrl} from "geotiff";
173
+ const tiff = await fromUrl('ca_nrc_NA83SCRS.tif');
174
+ await proj4.nadgrid('ca_nrc_NA83SCRS.tif', tiff).ready;
175
+ ```
176
+
177
+ Then use the given key in your definition, e.g. `proj4.defs("EPSG:32188","+proj=tmerc +lat_0=0 +lon_0=-73.5 +k=0.9999 +x_0=304800 +y_0=0 +ellps=GRS80 +nadgrids=ca_nrc_NA83SCRS.tif +units=m +no_defs +type=crs");` noting the `+nadgrids=ca_nrc_NA83SCRS.tif` parameter.
178
+
167
179
  ## TypeScript
168
180
 
169
181
  TypeScript implementation was added to the [DefinitelyTyped repository](https://github.com/DefinitelyTyped/DefinitelyTyped).
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proj4",
3
- "version": "2.16.2",
3
+ "version": "2.19.0",
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://github.com/proj4js/proj4js",
6
6
  "main": "dist/proj4.js",
package/component.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proj4",
3
- "version": "2.16.2",
3
+ "version": "2.19.0",
4
4
  "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
5
5
  "repo": "proj4js/proj4js",
6
6
  "keywords": [
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,71 @@
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 {string} */
56
+ name: string;
57
+ /** @type {string} */
58
+ title: string;
59
+ a: any;
60
+ b: any;
61
+ rf: any;
62
+ sphere: any;
63
+ es: number;
64
+ e: number;
65
+ ep2: number;
66
+ datum: DatumDefinition;
67
+ }
68
+ declare namespace Projection {
69
+ export { projections };
70
+ }
71
+ import projections from './projections';
@@ -0,0 +1 @@
1
+ export default function _default(crs: any, denorm: any, point: any): import("./core").InterfaceCoordinates;
@@ -0,0 +1 @@
1
+ export default function _default(point: any): void;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): any;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): any;
@@ -0,0 +1 @@
1
+ export default function _default(zone: any, lon: any): any;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(pp: any, arg_r: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(pp: any, arg_r: any, arg_i: any): number[];
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any, L: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(a: any, e: any, sinphi: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(pp: any, B: any): any;
@@ -0,0 +1 @@
1
+ export default function _default(x: any, y: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(ml: any, e0: any, e1: any, e2: any, e3: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(eccent: any, ts: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(eccent: any, q: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(eccent: any, phi: any, sinphi: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): any;
@@ -0,0 +1 @@
1
+ export default function _default(e0: any, e1: any, e2: any, e3: any, phi: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(eccent: any, sinphi: any, cosphi: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(eccent: any, ts: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(es: any): number[];
@@ -0,0 +1 @@
1
+ export default function _default(arg: any, es: any, en: any): any;
@@ -0,0 +1 @@
1
+ export default function _default(phi: any, sphi: any, cphi: any, en: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(eccent: any, sinphi: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): 1 | -1;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(esinp: any, exp: any): number;
@@ -0,0 +1 @@
1
+ export default function _default(x: any): number;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {Array<number>} array
3
+ * @returns {import("../core").InterfaceCoordinates}
4
+ */
5
+ export default function _default(array: Array<number>): import("../core").InterfaceCoordinates;
@@ -0,0 +1 @@
1
+ export default function _default(eccent: any, phi: any, sinphi: any): number;
@@ -0,0 +1,35 @@
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
+ };