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.
- package/README.md +12 -0
- package/bower.json +1 -1
- package/component.json +1 -1
- package/dist/lib/Point.d.ts +24 -0
- package/dist/lib/Proj.d.ts +71 -0
- package/dist/lib/adjust_axis.d.ts +1 -0
- package/dist/lib/checkSanity.d.ts +1 -0
- package/dist/lib/common/acosh.d.ts +1 -0
- package/dist/lib/common/adjust_lat.d.ts +1 -0
- package/dist/lib/common/adjust_lon.d.ts +1 -0
- package/dist/lib/common/adjust_zone.d.ts +1 -0
- package/dist/lib/common/asinh.d.ts +1 -0
- package/dist/lib/common/asinhy.d.ts +1 -0
- package/dist/lib/common/asinz.d.ts +1 -0
- package/dist/lib/common/atanh.d.ts +1 -0
- package/dist/lib/common/clens.d.ts +1 -0
- package/dist/lib/common/clens_cmplx.d.ts +1 -0
- package/dist/lib/common/cosh.d.ts +1 -0
- package/dist/lib/common/e0fn.d.ts +1 -0
- package/dist/lib/common/e1fn.d.ts +1 -0
- package/dist/lib/common/e2fn.d.ts +1 -0
- package/dist/lib/common/e3fn.d.ts +1 -0
- package/dist/lib/common/fL.d.ts +1 -0
- package/dist/lib/common/gN.d.ts +1 -0
- package/dist/lib/common/gatg.d.ts +1 -0
- package/dist/lib/common/hypot.d.ts +1 -0
- package/dist/lib/common/imlfn.d.ts +1 -0
- package/dist/lib/common/invlatiso.d.ts +1 -0
- package/dist/lib/common/iqsfnz.d.ts +1 -0
- package/dist/lib/common/latiso.d.ts +1 -0
- package/dist/lib/common/log1py.d.ts +1 -0
- package/dist/lib/common/mlfn.d.ts +1 -0
- package/dist/lib/common/msfnz.d.ts +1 -0
- package/dist/lib/common/phi2z.d.ts +1 -0
- package/dist/lib/common/pj_enfn.d.ts +1 -0
- package/dist/lib/common/pj_inv_mlfn.d.ts +1 -0
- package/dist/lib/common/pj_mlfn.d.ts +1 -0
- package/dist/lib/common/qsfnz.d.ts +1 -0
- package/dist/lib/common/sign.d.ts +1 -0
- package/dist/lib/common/sinh.d.ts +1 -0
- package/dist/lib/common/srat.d.ts +1 -0
- package/dist/lib/common/tanh.d.ts +1 -0
- package/dist/lib/common/toPoint.d.ts +5 -0
- package/dist/lib/common/tsfnz.d.ts +1 -0
- package/dist/lib/common/vincenty.d.ts +35 -0
- package/dist/lib/constants/Datum.d.ts +1715 -0
- package/dist/lib/constants/Ellipsoid.d.ts +353 -0
- package/dist/lib/constants/PrimeMeridian.d.ts +16 -0
- package/dist/lib/constants/units.d.ts +63 -0
- package/dist/lib/constants/values.d.ts +19 -0
- package/dist/lib/core.d.ts +117 -0
- package/dist/lib/datum.d.ts +10 -0
- package/dist/lib/datumUtils.d.ts +28 -0
- package/dist/lib/datum_transform.d.ts +2 -0
- package/dist/lib/defs.d.ts +57 -0
- package/dist/lib/deriveConstants.d.ts +11 -0
- package/dist/lib/extend.d.ts +1 -0
- package/dist/lib/global.d.ts +1 -0
- package/dist/lib/includedProjections.d.ts +1 -0
- package/dist/lib/index.d.ts +24 -0
- package/dist/lib/match.d.ts +1 -0
- package/dist/lib/nadgrid.d.ts +107 -0
- package/dist/lib/parseCode.d.ts +6 -0
- package/dist/lib/projString.d.ts +5 -0
- package/dist/lib/projections/aea.d.ts +83 -0
- package/dist/lib/projections/aeqd.d.ts +32 -0
- package/dist/lib/projections/bonne.d.ts +27 -0
- package/dist/lib/projections/cass.d.ts +36 -0
- package/dist/lib/projections/cea.d.ts +28 -0
- package/dist/lib/projections/eqc.d.ts +20 -0
- package/dist/lib/projections/eqdc.d.ts +71 -0
- package/dist/lib/projections/eqearth.d.ts +15 -0
- package/dist/lib/projections/equi.d.ts +40 -0
- package/dist/lib/projections/etmerc.d.ts +45 -0
- package/dist/lib/projections/gauss.d.ts +38 -0
- package/dist/lib/projections/geocent.d.ts +22 -0
- package/dist/lib/projections/geos.d.ts +51 -0
- package/dist/lib/projections/gnom.d.ts +37 -0
- package/dist/lib/projections/gstmerc.d.ts +41 -0
- package/dist/lib/projections/krovak.d.ts +34 -0
- package/dist/lib/projections/laea.d.ts +70 -0
- package/dist/lib/projections/lcc.d.ts +36 -0
- package/dist/lib/projections/longlat.d.ts +11 -0
- package/dist/lib/projections/merc.d.ts +30 -0
- package/dist/lib/projections/mill.d.ts +11 -0
- package/dist/lib/projections/moll.d.ts +11 -0
- package/dist/lib/projections/nzmg.d.ts +33 -0
- package/dist/lib/projections/omerc.d.ts +60 -0
- package/dist/lib/projections/ortho.d.ts +25 -0
- package/dist/lib/projections/poly.d.ts +32 -0
- package/dist/lib/projections/qsc.d.ts +31 -0
- package/dist/lib/projections/robin.d.ts +24 -0
- package/dist/lib/projections/sinu.d.ts +37 -0
- package/dist/lib/projections/somerc.d.ts +35 -0
- package/dist/lib/projections/stere.d.ts +52 -0
- package/dist/lib/projections/sterea.d.ts +33 -0
- package/dist/lib/projections/tmerc.d.ts +38 -0
- package/dist/lib/projections/tpers.d.ts +45 -0
- package/dist/lib/projections/utm.d.ts +19 -0
- package/dist/lib/projections/vandg.d.ts +28 -0
- package/dist/lib/projections.d.ts +10 -0
- package/dist/lib/transform.d.ts +8 -0
- package/dist/proj4-src.js +908 -249
- package/dist/proj4.js +1 -1
- package/dist/projs.d.ts +1 -0
- package/lib/Point.js +9 -3
- package/lib/Proj.js +25 -1
- package/lib/adjust_axis.js +1 -0
- package/lib/common/toPoint.js +4 -0
- package/lib/common/vincenty.js +123 -0
- package/lib/constants/PrimeMeridian.js +16 -15
- package/lib/core.js +152 -16
- package/lib/defs.js +65 -5
- package/lib/index.js +17 -11
- package/lib/nadgrid.js +132 -2
- package/lib/parseCode.js +5 -1
- package/lib/projString.js +6 -0
- package/lib/projections/aea.js +25 -0
- package/lib/projections/aeqd.js +22 -26
- package/lib/projections/bonne.js +11 -0
- package/lib/projections/cass.js +11 -0
- package/lib/projections/cea.js +7 -1
- package/lib/projections/eqdc.js +29 -7
- package/lib/projections/equi.js +11 -2
- package/lib/projections/etmerc.js +12 -0
- package/lib/projections/gauss.js +12 -0
- package/lib/projections/geos.js +16 -0
- package/lib/projections/gnom.js +11 -2
- package/lib/projections/gstmerc.js +12 -0
- package/lib/projections/laea.js +30 -11
- package/lib/projections/lcc.js +10 -0
- package/lib/projections/merc.js +9 -0
- package/lib/projections/omerc.js +29 -4
- package/lib/projections/ortho.js +7 -0
- package/lib/projections/poly.js +14 -0
- package/lib/projections/qsc.js +11 -0
- package/lib/projections/sinu.js +11 -0
- package/lib/projections/somerc.js +10 -0
- package/lib/projections/stere.js +16 -2
- package/lib/projections/sterea.js +10 -0
- package/lib/projections/tmerc.js +8 -0
- package/lib/projections/tpers.js +24 -3
- package/lib/projections/utm.js +1 -0
- package/lib/projections/vandg.js +9 -2
- package/lib/transform.js +9 -0
- package/package.json +9 -10
- package/tsconfig.json +14 -0
- package/.github/workflows/build-and-test.yml +0 -69
- package/.nyc_output/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +0 -1
- package/.nyc_output/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +0 -1
- package/.nyc_output/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +0 -1
- package/.nyc_output/processinfo/6b047fc9-1bf2-4565-9e8a-9c0defc09dd7.json +0 -1
- package/.nyc_output/processinfo/e2c5d0cc-9478-4f26-ad2f-de246d4c35de.json +0 -1
- package/.nyc_output/processinfo/f4b0e40f-04ca-4b6d-bfeb-51d617db9841.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/scripts/readme.md +0 -10
- package/scripts/updateDatums.mjs +0 -119
- package/scripts/updateEllipsoids.mjs +0 -70
- package/test/BETA2007.gsb +0 -0
- package/test/ntv2_0_downsampled.gsb +0 -0
- package/test/ntv2_0_downsampled_no_error_columns.gsb +0 -0
- package/test/opt.html +0 -28
- package/test/puppeteer-tests.mjs +0 -110
- package/test/test-ci.mjs +0 -10
- package/test/test.js +0 -639
- package/test/testData.js +0 -2386
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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/scripts/readme.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
The script in this directory can be used to update `lib/constants/Datum.js` with data from a [`proj.db`](https://proj.org/en/stable/resource_files.html#proj-db) file placed in the root of the repository.
|
|
2
|
-
|
|
3
|
-
After running the script, the formatting needs to be fixed.
|
|
4
|
-
|
|
5
|
-
A complete command sequence (issued from the root of the repository) would look like this:
|
|
6
|
-
|
|
7
|
-
npm install sqlite3
|
|
8
|
-
node scripts/updateDatums.mjs
|
|
9
|
-
npm uninstall sqlite3
|
|
10
|
-
npm run format
|
package/scripts/updateDatums.mjs
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import sqlite3 from 'sqlite3';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import datums from '../lib/constants/Datum.js'; // Import the datums object directly
|
|
6
|
-
|
|
7
|
-
const DATUM_OVERRIDES = {
|
|
8
|
-
EPSG_4149: {
|
|
9
|
-
towgs84: '674.374,15.056,405.346'
|
|
10
|
-
},
|
|
11
|
-
EPSG_4267: {
|
|
12
|
-
towgs84: '-8.0,160.0,176.0'
|
|
13
|
-
},
|
|
14
|
-
EPSG_4818: {
|
|
15
|
-
towgs84: '589,76,480'
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Get the current file's directory
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
// Open proj.db
|
|
24
|
-
const dbPath = path.resolve(__dirname, '../proj.db');
|
|
25
|
-
const db = new sqlite3.Database(dbPath);
|
|
26
|
-
|
|
27
|
-
for (const key in datums) {
|
|
28
|
-
if (key === datums[key].datumName && datums[datums[key].datumName] === datums[key]) {
|
|
29
|
-
delete datums[key];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const databaseDatumNames = new Set();
|
|
34
|
-
|
|
35
|
-
// Query proj.db for Helmert transforms with method_code = 9606
|
|
36
|
-
db.all(
|
|
37
|
-
`SELECT ht.source_crs_auth_name,
|
|
38
|
-
ht.source_crs_code,
|
|
39
|
-
ht.tx, ht.ty, ht.tz,
|
|
40
|
-
ht.rx, ht.ry, ht.rz,
|
|
41
|
-
ht.scale_difference,
|
|
42
|
-
ht.accuracy,
|
|
43
|
-
gd.name AS datum_name,
|
|
44
|
-
cv.name AS datum_code,
|
|
45
|
-
e.name AS ellipse_name,
|
|
46
|
-
ht.method_code
|
|
47
|
-
FROM helmert_transformation ht
|
|
48
|
-
JOIN crs_view cv
|
|
49
|
-
ON ht.source_crs_auth_name = cv.auth_name
|
|
50
|
-
AND ht.source_crs_code = cv.code
|
|
51
|
-
JOIN geodetic_crs gcrs
|
|
52
|
-
ON cv.table_name = 'geodetic_crs'
|
|
53
|
-
AND cv.auth_name = gcrs.auth_name
|
|
54
|
-
AND cv.code = gcrs.code
|
|
55
|
-
JOIN geodetic_datum gd
|
|
56
|
-
ON gcrs.datum_auth_name = gd.auth_name
|
|
57
|
-
AND gcrs.datum_code = gd.code
|
|
58
|
-
JOIN ellipsoid e
|
|
59
|
-
ON gd.ellipsoid_auth_name = e.auth_name
|
|
60
|
-
AND gd.ellipsoid_code = e.code
|
|
61
|
-
WHERE ht.deprecated = 0
|
|
62
|
-
AND ht.method_code IN (9606, 9607, 9603)
|
|
63
|
-
AND (ht.target_crs_auth_name = 'EPSG' AND ht.target_crs_code IN ('4326', '7019', '4258')) -- WGS84, GRS80, ETRS89
|
|
64
|
-
AND cv.type != 'vertical' -- Exclude vertical datums
|
|
65
|
-
ORDER BY
|
|
66
|
-
ht.accuracy ASC,
|
|
67
|
-
CASE ht.method_code
|
|
68
|
-
WHEN 9606 THEN 1
|
|
69
|
-
WHEN 9607 THEN 2
|
|
70
|
-
WHEN 9603 THEN 3
|
|
71
|
-
ELSE 4
|
|
72
|
-
END ASC`, // Sort by method_code (9606 first, then 9607), then by accuracy`, // Assuming lower accuracy values are better
|
|
73
|
-
(err, rows) => {
|
|
74
|
-
if (err) {
|
|
75
|
-
console.error('Error querying proj.db:', err);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
rows.forEach((row) => {
|
|
80
|
-
const normalizedDatumName = row.datum_name.toLowerCase();
|
|
81
|
-
|
|
82
|
-
// Skip if the datumName already exists (case-insensitive)
|
|
83
|
-
if (databaseDatumNames.has(normalizedDatumName)) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (row.method_code === 9607 && row.rx) {
|
|
88
|
-
row.rx = -row.rx;
|
|
89
|
-
row.ry = -row.ry;
|
|
90
|
-
row.rz = -row.rz;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Construct the towgs84 string from tx, ty, tz, rx, ry, rz, and scale_difference
|
|
94
|
-
const towgs84 = row.rx ? `${row.tx},${row.ty},${row.tz},${row.rx},${row.ry},${row.rz},${row.scale_difference}` : `${row.tx},${row.ty},${row.tz}`;
|
|
95
|
-
|
|
96
|
-
datums[`${row.source_crs_auth_name}_${row.source_crs_code}`] = {
|
|
97
|
-
towgs84
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
databaseDatumNames.add(normalizedDatumName);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
Object.assign(datums, DATUM_OVERRIDES);
|
|
104
|
-
|
|
105
|
-
// Write updated datums back to Datum.js
|
|
106
|
-
const datumFilePath = path.resolve(__dirname, '../lib/constants/Datum.js');
|
|
107
|
-
const updatedContent = `var datums = ${JSON.stringify(datums, null, 2)};\n\n`
|
|
108
|
-
+ `for (var key in datums) {\n`
|
|
109
|
-
+ ` var datum = datums[key];\n`
|
|
110
|
-
+ ` if (!datum.datumName) {\n`
|
|
111
|
-
+ ` continue;\n`
|
|
112
|
-
+ ` }\n`
|
|
113
|
-
+ ` datums[datum.datumName] = datum;\n`
|
|
114
|
-
+ `}\n\n`
|
|
115
|
-
+ `export default datums;`;
|
|
116
|
-
fs.writeFileSync(datumFilePath, updatedContent, 'utf-8');
|
|
117
|
-
console.log('Datum.js updated successfully!');
|
|
118
|
-
}
|
|
119
|
-
);
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import sqlite3 from 'sqlite3';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import datums from '../lib/constants/Datum.js'; // Import datums directly
|
|
5
|
-
import ellipsoids from '../lib/constants/Ellipsoid.js'; // Import ellipsoids directly
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
|
-
// Get the current file's directory
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
|
|
12
|
-
// Extract ellipsoid keys and ellipseName values from Ellipsoid.js
|
|
13
|
-
const ellipsoidKeys = Object.keys(ellipsoids);
|
|
14
|
-
const ellipsoidNames = Object.values(ellipsoids).map(ellipsoid => ellipsoid.ellipseName);
|
|
15
|
-
|
|
16
|
-
// Combine ellipsoid keys and ellipseName values into a single set
|
|
17
|
-
const ellipsoidSet = new Set([...ellipsoidKeys, ...ellipsoidNames]);
|
|
18
|
-
|
|
19
|
-
// Extract ellipse values from Datum.js
|
|
20
|
-
const datumEllipses = new Set(Object.values(datums).map(datum => datum.ellipse));
|
|
21
|
-
|
|
22
|
-
// Find missing ellipses
|
|
23
|
-
const missingEllipses = [...datumEllipses].filter(ellipse => !ellipsoidSet.has(ellipse));
|
|
24
|
-
|
|
25
|
-
// If no missing ellipses, exit early
|
|
26
|
-
if (missingEllipses.length === 0) {
|
|
27
|
-
console.log('No missing ellipses found.');
|
|
28
|
-
process.exit(0);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Open proj.db
|
|
32
|
-
const dbPath = path.resolve(__dirname, '../proj.db');
|
|
33
|
-
const db = new sqlite3.Database(dbPath);
|
|
34
|
-
|
|
35
|
-
// Query the ellipsoid table for missing ellipses
|
|
36
|
-
const placeholders = missingEllipses.map(() => '?').join(',');
|
|
37
|
-
const query = `
|
|
38
|
-
SELECT e.auth_name || ':' || e.code AS key,
|
|
39
|
-
e.semi_major_axis AS a,
|
|
40
|
-
e.inv_flattening AS rf,
|
|
41
|
-
e.name AS ellipseName
|
|
42
|
-
FROM ellipsoid e
|
|
43
|
-
WHERE e.name IN (${placeholders})
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
db.all(query, missingEllipses, (err, rows) => {
|
|
47
|
-
if (err) {
|
|
48
|
-
console.error('Error querying proj.db:', err);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Add missing ellipsoids to the ellipsoids object
|
|
53
|
-
rows.forEach((row) => {
|
|
54
|
-
const key = row.key.replace(/:/g, '_'); // Replace ":" with "_" for valid JavaScript keys
|
|
55
|
-
ellipsoids[key] = {
|
|
56
|
-
a: row.a,
|
|
57
|
-
rf: row.rf,
|
|
58
|
-
ellipseName: row.ellipseName
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Write the updated ellipsoids object back to Ellipsoid.js
|
|
63
|
-
const ellipsoidFilePath = path.resolve(__dirname, '../lib/constants/Ellipsoid.js');
|
|
64
|
-
const ellipsoidContent = `var ellipsoids = ${JSON.stringify(ellipsoids, null, 2)};\n\nexport default ellipsoids;`;
|
|
65
|
-
fs.writeFileSync(ellipsoidFilePath, ellipsoidContent, 'utf-8');
|
|
66
|
-
console.log(`Ellipsoid.js updated successfully with ${rows.length} missing ellipsoids.`);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// Close the database connection
|
|
70
|
-
db.close();
|
package/test/BETA2007.gsb
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/test/opt.html
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Mocha Tests</title>
|
|
6
|
-
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
|
7
|
-
</head>
|
|
8
|
-
<body><div id="mocha"></div>
|
|
9
|
-
<script src="../node_modules/mocha/mocha.js"></script>
|
|
10
|
-
<script src="../node_modules/chai/chai.js" type="module"></script>
|
|
11
|
-
<script src="testData.js"></script>
|
|
12
|
-
<script src="../dist/proj4.js"></script>
|
|
13
|
-
<script src="test.js"></script>
|
|
14
|
-
<script type="module">
|
|
15
|
-
import * as chai from '../node_modules/chai/chai.js';
|
|
16
|
-
|
|
17
|
-
mocha.setup({
|
|
18
|
-
reporter: "JSON",
|
|
19
|
-
ui: 'bdd',
|
|
20
|
-
globals: [],
|
|
21
|
-
timeout: 300000,
|
|
22
|
-
checkLeaks: false
|
|
23
|
-
});
|
|
24
|
-
startTests(chai,proj4,testPoints);
|
|
25
|
-
mocha.run();
|
|
26
|
-
</script>
|
|
27
|
-
</body>
|
|
28
|
-
</html>
|
package/test/puppeteer-tests.mjs
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer';
|
|
2
|
-
import http from 'http';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import assert from 'assert';
|
|
6
|
-
|
|
7
|
-
const hostname = process.env.HOST || '127.0.0.1'; // use hostname 127.0.0.1 unless there exists a preconfigured port
|
|
8
|
-
const port = process.env.PORT || 8080; // use port 8080 unless there exists a preconfigured port
|
|
9
|
-
|
|
10
|
-
const server = http.createServer(function (request, response) {
|
|
11
|
-
let filePath = request.url;
|
|
12
|
-
|
|
13
|
-
if (filePath === '/') {
|
|
14
|
-
filePath = 'index.html';
|
|
15
|
-
} else {
|
|
16
|
-
filePath = './' + request.url;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let extname = String(path.extname(filePath)).toLowerCase();
|
|
20
|
-
let mimeTypes = {
|
|
21
|
-
'.html': 'text/html',
|
|
22
|
-
'.js': 'text/javascript',
|
|
23
|
-
'.css': 'text/css',
|
|
24
|
-
'.json': 'application/json',
|
|
25
|
-
'.png': 'image/png',
|
|
26
|
-
'.jpg': 'image/jpg',
|
|
27
|
-
'.gif': 'image/gif',
|
|
28
|
-
'.svg': 'image/svg+xml',
|
|
29
|
-
'.wav': 'audio/wav',
|
|
30
|
-
'.mp4': 'video/mp4',
|
|
31
|
-
'.woff': 'application/font-woff',
|
|
32
|
-
'.ttf': 'application/font-ttf',
|
|
33
|
-
'.eot': 'application/vnd.ms-fontobject',
|
|
34
|
-
'.otf': 'application/font-otf',
|
|
35
|
-
'.wasm': 'application/wasm',
|
|
36
|
-
'.ico': 'image/x-icon'
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
let contentType = mimeTypes[extname] || 'application/octet-stream';
|
|
40
|
-
|
|
41
|
-
fs.readFile(filePath, function (error, content) {
|
|
42
|
-
if (error) {
|
|
43
|
-
if (error.code === 'ENOENT') {
|
|
44
|
-
fs.readFile('public/404.html', function (error, content) {
|
|
45
|
-
response.writeHead(404, { 'Content-Type': 'text/html' });
|
|
46
|
-
response.end(content, 'utf-8');
|
|
47
|
-
});
|
|
48
|
-
} else {
|
|
49
|
-
response.writeHead(500);
|
|
50
|
-
response.end('Sorry, check with the site admin for error: ' + error.code + ' ..\n');
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
response.writeHead(200, { 'Content-Type': contentType });
|
|
54
|
-
response.end(content, 'utf-8');
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
function timeoutPromise(timeout, callback) {
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
// Set up the timeout
|
|
61
|
-
const timer = setTimeout(() => {
|
|
62
|
-
reject(new Error(`Promise timed out after ${timeout} ms`));
|
|
63
|
-
}, timeout);
|
|
64
|
-
|
|
65
|
-
// Set up the real work
|
|
66
|
-
callback(
|
|
67
|
-
(value) => {
|
|
68
|
-
clearTimeout(timer);
|
|
69
|
-
resolve(value);
|
|
70
|
-
},
|
|
71
|
-
(error) => {
|
|
72
|
-
clearTimeout(timer);
|
|
73
|
-
reject(error);
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
(async () => {
|
|
79
|
-
server.listen(port, hostname);
|
|
80
|
-
|
|
81
|
-
// Launch the browser and open a new blank page
|
|
82
|
-
|
|
83
|
-
const browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox'] });
|
|
84
|
-
const page = await browser.newPage();
|
|
85
|
-
|
|
86
|
-
// Navigate the page to a URL
|
|
87
|
-
await page.goto('http://' + hostname + ':' + port + '/test/opt.html');
|
|
88
|
-
|
|
89
|
-
// Set screen size
|
|
90
|
-
await page.setViewport({ width: 1080, height: 1024 });
|
|
91
|
-
|
|
92
|
-
// Type into search box
|
|
93
|
-
const testResult = await timeoutPromise(10000, (resolve) => {
|
|
94
|
-
page.on('console', (consoleMessage) => {
|
|
95
|
-
if (consoleMessage.type() === 'log') {
|
|
96
|
-
const res = JSON.parse(consoleMessage.text());
|
|
97
|
-
if (res.stats !== undefined) {
|
|
98
|
-
resolve(res.stats);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
assert.strictEqual(testResult.failures, 0, 'Tests: passed: ' + testResult.passes + ', fail: ' + testResult.failures + ', total:' + testResult.tests);
|
|
105
|
-
assert.strictEqual(testResult.tests, testResult.passes, 'Tests: ' + testResult.passes + '/' + testResult.tests);
|
|
106
|
-
console.log('Tests: ' + testResult.passes + '/' + testResult.tests);
|
|
107
|
-
|
|
108
|
-
await browser.close();
|
|
109
|
-
server.close();
|
|
110
|
-
})();
|
package/test/test-ci.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as chai from 'chai';
|
|
2
|
-
import proj4 from '../dist/proj4-src.js';
|
|
3
|
-
import testData from './testData.js';
|
|
4
|
-
import startTests from './test.js';
|
|
5
|
-
|
|
6
|
-
if (typeof process !== 'undefined' && process.toString() === '[object process]') {
|
|
7
|
-
(async function () {
|
|
8
|
-
startTests(chai, proj4, testData);
|
|
9
|
-
})();
|
|
10
|
-
}
|