proj4 2.15.0 → 2.16.1
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/.github/workflows/build-and-test.yml +45 -7
- package/.nyc_output/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +1 -0
- package/.nyc_output/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +1 -0
- package/.nyc_output/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +1 -0
- package/.nyc_output/processinfo/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +1 -0
- package/.nyc_output/processinfo/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +1 -0
- package/.nyc_output/processinfo/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/Gruntfile.js +20 -84
- package/README.md +20 -6
- package/bower.json +1 -1
- package/component.json +1 -1
- package/dist/proj4-src.js +8934 -7083
- package/dist/proj4.js +1 -1
- package/eslint.config.mjs +41 -0
- package/lib/Point.js +4 -4
- package/lib/Proj.js +7 -8
- package/lib/adjust_axis.js +30 -33
- package/lib/common/acosh.js +2 -2
- package/lib/common/adjust_lat.js +2 -2
- package/lib/common/adjust_lon.js +2 -3
- package/lib/common/adjust_zone.js +1 -1
- package/lib/common/asinh.js +2 -2
- package/lib/common/asinhy.js +1 -1
- package/lib/common/asinz.js +2 -2
- package/lib/common/atanh.js +2 -2
- package/lib/common/clens.js +1 -1
- package/lib/common/clens_cmplx.js +1 -1
- package/lib/common/cosh.js +2 -2
- package/lib/common/e0fn.js +2 -2
- package/lib/common/e1fn.js +2 -2
- package/lib/common/e2fn.js +2 -2
- package/lib/common/e3fn.js +2 -2
- package/lib/common/fL.js +2 -2
- package/lib/common/gN.js +2 -2
- package/lib/common/gatg.js +1 -1
- package/lib/common/hypot.js +1 -1
- package/lib/common/imlfn.js +3 -3
- package/lib/common/invlatiso.js +2 -2
- package/lib/common/iqsfnz.js +5 -6
- package/lib/common/latiso.js +2 -2
- package/lib/common/log1py.js +1 -1
- package/lib/common/mlfn.js +2 -2
- package/lib/common/msfnz.js +2 -2
- package/lib/common/phi2z.js +3 -3
- package/lib/common/pj_enfn.js +2 -2
- package/lib/common/pj_inv_mlfn.js +6 -6
- package/lib/common/pj_mlfn.js +2 -2
- package/lib/common/qsfnz.js +3 -4
- package/lib/common/sign.js +3 -3
- package/lib/common/sinh.js +2 -2
- package/lib/common/srat.js +2 -2
- package/lib/common/tanh.js +2 -2
- package/lib/common/toPoint.js +4 -4
- package/lib/common/tsfnz.js +2 -2
- package/lib/constants/Datum.js +1228 -46
- package/lib/constants/Ellipsoid.js +225 -266
- package/lib/constants/PrimeMeridian.js +14 -14
- package/lib/constants/units.js +20 -20
- package/lib/constants/values.js +4 -4
- package/lib/core.js +2 -2
- package/lib/datum.js +2 -2
- package/lib/datumUtils.js +9 -14
- package/lib/datum_transform.js +26 -26
- package/lib/defs.js +10 -20
- package/lib/deriveConstants.js +4 -2
- package/lib/extend.js +1 -1
- package/lib/global.js +6 -6
- package/lib/includedProjections.js +25 -25
- package/lib/index.js +9 -9
- package/lib/nadgrid.js +36 -14
- package/lib/parseCode.js +10 -11
- package/lib/projString.js +41 -44
- package/lib/projections/aea.js +7 -12
- package/lib/projections/aeqd.js +51 -86
- package/lib/projections/bonne.js +11 -13
- package/lib/projections/cass.js +8 -15
- package/lib/projections/cea.js +7 -9
- package/lib/projections/eqc.js +2 -5
- package/lib/projections/eqdc.js +10 -16
- package/lib/projections/eqearth.js +17 -17
- package/lib/projections/equi.js +4 -6
- package/lib/projections/etmerc.js +9 -11
- package/lib/projections/gauss.js +3 -3
- package/lib/projections/geocent.js +13 -14
- package/lib/projections/geos.js +136 -137
- package/lib/projections/gnom.js +8 -13
- package/lib/projections/gstmerc.js +2 -5
- package/lib/projections/krovak.js +3 -3
- package/lib/projections/laea.js +85 -97
- package/lib/projections/lcc.js +28 -33
- package/lib/projections/longlat.js +4 -4
- package/lib/projections/merc.js +12 -19
- package/lib/projections/mill.js +6 -7
- package/lib/projections/moll.js +8 -9
- package/lib/projections/nzmg.js +2 -2
- package/lib/projections/omerc.js +55 -57
- package/lib/projections/ortho.js +9 -10
- package/lib/projections/poly.js +13 -21
- package/lib/projections/qsc.js +19 -21
- package/lib/projections/robin.js +118 -118
- package/lib/projections/sinu.js +12 -23
- package/lib/projections/somerc.js +3 -3
- package/lib/projections/stere.js +29 -41
- package/lib/projections/sterea.js +3 -4
- package/lib/projections/tmerc.js +29 -36
- package/lib/projections/tpers.js +14 -15
- package/lib/projections/utm.js +3 -4
- package/lib/projections/vandg.js +15 -21
- package/lib/projections.js +12 -4
- package/lib/transform.js +3 -3
- package/package.json +29 -22
- package/projs.js +2 -2
- package/publish.sh +2 -2
- package/rollup.config.mjs +29 -0
- package/scripts/readme.md +10 -0
- package/scripts/updateDatums.mjs +119 -0
- package/scripts/updateEllipsoids.mjs +70 -0
- package/test/ntv2_0_downsampled_no_error_columns.gsb +0 -0
- package/test/opt.html +27 -24
- package/test/puppeteer-tests.mjs +110 -0
- package/test/test-ci.mjs +10 -0
- package/test/test.js +197 -125
- package/test/testData.js +1802 -312
- package/.jshintrc +0 -12
- package/test/amd.html +0 -63
- package/test/package.json.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":null,"pid":90528,"argv":["/Users/ahocevar/.nvm/versions/node/v22.13.0/bin/node","/Users/ahocevar/.nvm/versions/node/v22.13.0/bin/npm","run","test:ci"],"execArgv":[],"cwd":"/Users/ahocevar/projects/proj4js","time":1739305208087,"ppid":90520,"coverageFilename":"/Users/ahocevar/projects/proj4js/.nyc_output/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json","externalId":"","uuid":"6b047fc9-1bf2-4565-9e8a-9c0defc09dd7","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"f4b0e40f-04ca-4b6d-bfeb-51d617db9841","pid":90576,"argv":["/Users/ahocevar/.nvm/versions/node/v22.13.0/bin/node","/Users/ahocevar/projects/proj4js/node_modules/.bin/mocha","test/test-ci.mjs"],"execArgv":[],"cwd":"/Users/ahocevar/projects/proj4js","time":1739305208556,"ppid":90549,"coverageFilename":"/Users/ahocevar/projects/proj4js/.nyc_output/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json","externalId":"","uuid":"e2c5d0cc-9478-4f26-ad2f-de246d4c35de","files":["/Users/ahocevar/projects/proj4js/dist/proj4-src.js"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"6b047fc9-1bf2-4565-9e8a-9c0defc09dd7","pid":90549,"argv":["/Users/ahocevar/.nvm/versions/node/v22.13.0/bin/node","/Users/ahocevar/.nvm/versions/node/v22.13.0/lib/node_modules/npm/bin/npm-cli.js","exec","--yes","--","mocha","test/test-ci.mjs"],"execArgv":[],"cwd":"/Users/ahocevar/projects/proj4js","time":1739305208222,"ppid":90528,"coverageFilename":"/Users/ahocevar/projects/proj4js/.nyc_output/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json","externalId":"","uuid":"f4b0e40f-04ca-4b6d-bfeb-51d617db9841","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"processes":{"6b047fc9-1bf2-4565-9e8a-9c0defc09dd7":{"parent":null,"children":["f4b0e40f-04ca-4b6d-bfeb-51d617db9841"]},"e2c5d0cc-9478-4f26-ad2f-de246d4c35de":{"parent":"f4b0e40f-04ca-4b6d-bfeb-51d617db9841","children":[]},"f4b0e40f-04ca-4b6d-bfeb-51d617db9841":{"parent":"6b047fc9-1bf2-4565-9e8a-9c0defc09dd7","children":["e2c5d0cc-9478-4f26-ad2f-de246d4c35de"]}},"files":{"/Users/ahocevar/projects/proj4js/dist/proj4-src.js":["e2c5d0cc-9478-4f26-ad2f-de246d4c35de"]},"externalIds":{}}
|
package/Gruntfile.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
var json = require('rollup-plugin-json');
|
|
2
|
-
var nodeResolve = require('rollup-plugin-node-resolve');
|
|
3
|
-
var replace = require('rollup-plugin-replace');
|
|
4
|
-
var pkg = require('./package.json');
|
|
5
|
-
|
|
6
1
|
var projs = [
|
|
7
2
|
'tmerc',
|
|
8
3
|
'etmerc',
|
|
@@ -38,91 +33,32 @@ var projs = [
|
|
|
38
33
|
];
|
|
39
34
|
module.exports = function (grunt) {
|
|
40
35
|
grunt.initConfig({
|
|
41
|
-
pkg: grunt.file.readJSON('package.json')
|
|
42
|
-
connect: {
|
|
43
|
-
server: {
|
|
44
|
-
options: {
|
|
45
|
-
port: process.env.PORT || 8080,
|
|
46
|
-
base: '.'
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
mocha_phantomjs: {
|
|
51
|
-
all: {
|
|
52
|
-
options: {
|
|
53
|
-
reporter: "dot",
|
|
54
|
-
urls: [ //my ide requries process.env.IP and PORT
|
|
55
|
-
"http://" + (process.env.IP || "127.0.0.1") + ":" + (process.env.PORT || "8080") + "/test/amd.html",
|
|
56
|
-
"http://" + (process.env.IP || "127.0.0.1") + ":" + (process.env.PORT || "8080") + "/test/opt.html"
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
jshint: {
|
|
62
|
-
options: {
|
|
63
|
-
jshintrc: "./.jshintrc"
|
|
64
|
-
},
|
|
65
|
-
all: ['./lib/*.js', './lib/*/*.js']
|
|
66
|
-
},
|
|
67
|
-
rollup: {
|
|
68
|
-
options: {
|
|
69
|
-
format: "umd",
|
|
70
|
-
moduleName: "proj4",
|
|
71
|
-
plugins: [
|
|
72
|
-
replace({
|
|
73
|
-
__VERSION__: pkg.version
|
|
74
|
-
}),
|
|
75
|
-
json(),
|
|
76
|
-
nodeResolve()
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
files: {
|
|
80
|
-
dest: './dist/proj4-src.js',
|
|
81
|
-
src: './lib/index.js',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
uglify: {
|
|
85
|
-
options: {
|
|
86
|
-
report: 'gzip',
|
|
87
|
-
mangle:{
|
|
88
|
-
reserved: ['proj4','Projection','Point']
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
all: {
|
|
92
|
-
src: 'dist/proj4-src.js',
|
|
93
|
-
dest: 'dist/proj4.js'
|
|
94
|
-
}
|
|
95
|
-
}
|
|
36
|
+
pkg: grunt.file.readJSON('package.json')
|
|
96
37
|
});
|
|
97
|
-
|
|
98
|
-
grunt.
|
|
99
|
-
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
100
|
-
grunt.loadNpmTasks('grunt-contrib-connect');
|
|
101
|
-
grunt.loadNpmTasks('grunt-mocha-phantomjs');
|
|
102
|
-
grunt.registerTask('custom',function(){
|
|
103
|
-
grunt.task.run('rollup', 'uglify');
|
|
38
|
+
|
|
39
|
+
grunt.registerTask('custom', function () {
|
|
104
40
|
var projections = this.args;
|
|
105
|
-
if(projections[0]==='default'){
|
|
106
|
-
grunt.file.write('./projs.js','export default function(){}');
|
|
41
|
+
if (projections[0] === 'default') {
|
|
42
|
+
grunt.file.write('./projs.js', 'export default function(){}');
|
|
107
43
|
return;
|
|
108
44
|
}
|
|
109
|
-
if(projections[0]==='all'){
|
|
45
|
+
if (projections[0] === 'all') {
|
|
110
46
|
projections = projs;
|
|
111
47
|
}
|
|
112
|
-
grunt.file.write('./projs.js',[
|
|
113
|
-
projections.map(function(proj) {
|
|
114
|
-
return
|
|
115
|
-
}).join(
|
|
116
|
-
|
|
117
|
-
projections.map(function(proj) {
|
|
118
|
-
return
|
|
119
|
-
}).join(
|
|
120
|
-
|
|
121
|
-
].join(
|
|
48
|
+
grunt.file.write('./projs.js', [
|
|
49
|
+
projections.map(function (proj) {
|
|
50
|
+
return 'import ' + proj + ' from \'./lib/projections/' + proj + '\';';
|
|
51
|
+
}).join('\n'),
|
|
52
|
+
'export default function (proj4) {',
|
|
53
|
+
projections.map(function (proj) {
|
|
54
|
+
return ' proj4.Proj.projections.add(' + proj + ');';
|
|
55
|
+
}).join('\n'),
|
|
56
|
+
'}', ''
|
|
57
|
+
].join('\n'));
|
|
122
58
|
});
|
|
123
|
-
grunt.registerTask('build',function(){
|
|
124
|
-
var args = this.args.length?this.args[0].split(','):['default'];
|
|
125
|
-
grunt.task.run('
|
|
59
|
+
grunt.registerTask('build', function () {
|
|
60
|
+
var args = this.args.length ? this.args[0].split(',') : ['default'];
|
|
61
|
+
grunt.task.run('custom:' + args.join(':'));
|
|
126
62
|
});
|
|
127
|
-
grunt.registerTask('default', ['build:all'
|
|
63
|
+
grunt.registerTask('default', ['build:all']);
|
|
128
64
|
};
|
package/README.md
CHANGED
|
@@ -26,9 +26,7 @@ The basic signature is:
|
|
|
26
26
|
proj4([fromProjection, ]toProjection[, coordinates])
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Projections can be proj or wkt strings.
|
|
30
|
-
|
|
31
|
-
Wkt strings must be in form of [version 1](https://docs.ogc.org/is/18-010r7/18-010r7.html#196) (earlier than 2015). Have a look at the [wkt-parser](https://github.com/proj4js/wkt-parser) for more info, or use proj strings instead.
|
|
29
|
+
Projections can be proj or wkt strings, or PROJJSON objects.
|
|
32
30
|
|
|
33
31
|
Coordinates may be an object of the form `{x:x,y:y}` or an array of the form `[x,y]`.
|
|
34
32
|
|
|
@@ -140,9 +138,15 @@ proj4('+proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees +axis=neu', firstP
|
|
|
140
138
|
//the floating points to answer your question
|
|
141
139
|
```
|
|
142
140
|
|
|
141
|
+
## Datum Transformations
|
|
142
|
+
|
|
143
|
+
Proj4js has built-in Helmert transformations for many datums to transform to and from WGS84, which is used as pivot for datum transformations. If a datum is not available or not accurate enough for the desired region, custom Helmert transformations or grid based datum adjustments are supported.
|
|
144
|
+
|
|
145
|
+
WKT1 definitions can contain a `TOWGS84` parameter. For proj strings, `towgs84` or `nadgrids` can be specified. When using WKT2 or PROJJSON definitions, if a `BOUNDCRS` with an `ABRIDGEDTRANDFORMATION` to WGS84 is provided, Helmert transformation parameters (like `+towgs84=` in proj strings) or the name of the parameter file (like `+nadgrids=` in proj strings) will be extracted from it.
|
|
146
|
+
|
|
143
147
|
## Grid Based Datum Adjustments
|
|
144
148
|
|
|
145
|
-
To use `+nadgrids=` in a proj definition, 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:
|
|
149
|
+
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:
|
|
146
150
|
|
|
147
151
|
```javascript
|
|
148
152
|
const buffer = fs.readFileSync('ntv2.gsb').buffer
|
|
@@ -151,6 +155,15 @@ proj4.nadgrid('key', buffer);
|
|
|
151
155
|
|
|
152
156
|
then use the given key in your definition, e.g. `+nadgrids=@key,null`. See [Grid Based Datum Adjustments](https://proj.org/usage/transformation.html?highlight=nadgrids#grid-based-datum-adjustments).
|
|
153
157
|
|
|
158
|
+
Optionally, if your `.gsb` file does not contain latitude and longitude error columns, you can provide an `options` object argument to the `proj4.nadgrid` call, setting the `includeErrorFields` property to `false`, e.g:
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
const buffer = fs.readFileSync('ntv2.gsb').buffer
|
|
162
|
+
proj4.nadgrid('key', buffer, {includeErrorFields:false});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
If the options argument is omitted, `includeErrorFields` is assumed to be true.
|
|
166
|
+
|
|
154
167
|
## TypeScript
|
|
155
168
|
|
|
156
169
|
TypeScript implementation was added to the [DefinitelyTyped repository](https://github.com/DefinitelyTyped/DefinitelyTyped).
|
|
@@ -168,7 +181,7 @@ To do the complete build and browser tests run
|
|
|
168
181
|
node_modules/.bin/grunt
|
|
169
182
|
```
|
|
170
183
|
|
|
171
|
-
To run node tests run
|
|
184
|
+
To run node and browser tests run
|
|
172
185
|
|
|
173
186
|
```bash
|
|
174
187
|
npm test
|
|
@@ -177,7 +190,8 @@ npm test
|
|
|
177
190
|
To run node tests with coverage run
|
|
178
191
|
|
|
179
192
|
```bash
|
|
180
|
-
npm
|
|
193
|
+
npm run build
|
|
194
|
+
npm run test:coverage
|
|
181
195
|
```
|
|
182
196
|
|
|
183
197
|
To create a build with only default projections (latlon and Mercator) run
|
package/bower.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proj4",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.1",
|
|
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