gnss-js 1.3.0 → 1.3.2
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/analysis.cjs +29 -4
- package/dist/analysis.d.cts +1 -1
- package/dist/analysis.d.ts +1 -1
- package/dist/analysis.js +3 -3
- package/dist/{chunk-5SPJH4MG.js → chunk-2K3FCJBX.js} +1 -1
- package/dist/{chunk-OZCYOM5D.js → chunk-3U5AX7PY.js} +1 -1
- package/dist/chunk-4KOXMHUW.js +223 -0
- package/dist/{chunk-7EEWQ5DU.js → chunk-65CQINSB.js} +6 -1
- package/dist/{chunk-G3N4S3DM.js → chunk-AW6BORTZ.js} +31 -6
- package/dist/{chunk-W5WKEV7U.js → chunk-FIEWO4J4.js} +2 -0
- package/dist/{chunk-ZCNXERQ2.js → chunk-PQYBTE42.js} +11 -7
- package/dist/chunk-PX7TPPTQ.js +206 -0
- package/dist/constants.cjs +3 -0
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +3 -1
- package/dist/frames.js +6 -216
- package/dist/{gnss-BT6ulR17.d.cts → gnss-BtXrG3zH.d.cts} +3 -1
- package/dist/{gnss-C-tgoYNa.d.ts → gnss-DhnEr0Dy.d.ts} +3 -1
- package/dist/index.cjs +471 -14
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +28 -6
- package/dist/orbit.cjs +12 -7
- package/dist/orbit.d.cts +3 -1
- package/dist/orbit.d.ts +3 -1
- package/dist/orbit.js +4 -1
- package/dist/positioning.cjs +11 -9
- package/dist/positioning.d.cts +11 -3
- package/dist/positioning.d.ts +11 -3
- package/dist/positioning.js +6 -196
- package/dist/rinex.js +2 -2
- package/dist/rtcm3.cjs +5 -0
- package/dist/rtcm3.js +2 -2
- package/dist/signals.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computeDop,
|
|
3
|
+
computeSatPosition,
|
|
4
|
+
ecefToAzEl
|
|
5
|
+
} from "./chunk-PQYBTE42.js";
|
|
6
|
+
import {
|
|
7
|
+
C_LIGHT,
|
|
8
|
+
OMEGA_E
|
|
9
|
+
} from "./chunk-FIEWO4J4.js";
|
|
10
|
+
|
|
11
|
+
// src/positioning/index.ts
|
|
12
|
+
var GM_GPS = 3986005e8;
|
|
13
|
+
var F_REL = -4442807633e-19;
|
|
14
|
+
function satClockCorrection(eph, tMs) {
|
|
15
|
+
if (eph.system === "R" || eph.system === "S") {
|
|
16
|
+
const dt2 = (tMs - eph.tocDate.getTime()) / 1e3;
|
|
17
|
+
return eph.tauN + eph.gammaN * dt2;
|
|
18
|
+
}
|
|
19
|
+
const k = eph;
|
|
20
|
+
const dt = (tMs - k.tocDate.getTime()) / 1e3;
|
|
21
|
+
const poly = k.af0 + k.af1 * dt + k.af2 * dt * dt;
|
|
22
|
+
const a = k.sqrtA * k.sqrtA;
|
|
23
|
+
const n = Math.sqrt(GM_GPS / (a * a * a)) + k.deltaN;
|
|
24
|
+
const tk = dt;
|
|
25
|
+
const Mk = k.m0 + n * tk;
|
|
26
|
+
let Ek = Mk;
|
|
27
|
+
for (let i = 0; i < 8; i++) {
|
|
28
|
+
Ek = Mk + k.e * Math.sin(Ek);
|
|
29
|
+
}
|
|
30
|
+
const rel = F_REL * k.e * k.sqrtA * Math.sin(Ek);
|
|
31
|
+
return poly + rel;
|
|
32
|
+
}
|
|
33
|
+
function ionoFree(p1, p2, f1, f2) {
|
|
34
|
+
const g = f1 * f1 / (f1 * f1 - f2 * f2);
|
|
35
|
+
return g * p1 - (g - 1) * p2;
|
|
36
|
+
}
|
|
37
|
+
function tropoDelay(elevationRad) {
|
|
38
|
+
const sinEl = Math.sin(elevationRad);
|
|
39
|
+
return 2.47 / (sinEl + 0.0121);
|
|
40
|
+
}
|
|
41
|
+
function sagnac(pos, travelTimeS) {
|
|
42
|
+
const theta = OMEGA_E * travelTimeS;
|
|
43
|
+
const c = Math.cos(theta);
|
|
44
|
+
const s = Math.sin(theta);
|
|
45
|
+
return [pos.x * c + pos.y * s, -pos.x * s + pos.y * c, pos.z];
|
|
46
|
+
}
|
|
47
|
+
function solveLinear(A, b) {
|
|
48
|
+
const n = b.length;
|
|
49
|
+
const M = A.map((row, i) => [...row, b[i]]);
|
|
50
|
+
for (let col = 0; col < n; col++) {
|
|
51
|
+
let pivot = col;
|
|
52
|
+
for (let r = col + 1; r < n; r++) {
|
|
53
|
+
if (Math.abs(M[r][col]) > Math.abs(M[pivot][col])) pivot = r;
|
|
54
|
+
}
|
|
55
|
+
if (Math.abs(M[pivot][col]) < 1e-12) return null;
|
|
56
|
+
[M[col], M[pivot]] = [M[pivot], M[col]];
|
|
57
|
+
for (let r = 0; r < n; r++) {
|
|
58
|
+
if (r === col) continue;
|
|
59
|
+
const f = M[r][col] / M[col][col];
|
|
60
|
+
for (let c = col; c <= n; c++) M[r][c] -= f * M[col][c];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return M.map((row, i) => row[n] / M[i][i]);
|
|
64
|
+
}
|
|
65
|
+
function solveSpp(pseudoranges, ephemerides, timeMs, opts = {}) {
|
|
66
|
+
const {
|
|
67
|
+
elevationMaskDeg = 10,
|
|
68
|
+
troposphere = true,
|
|
69
|
+
maxIterations = 15,
|
|
70
|
+
convergenceM = 1e-4,
|
|
71
|
+
tgd = true
|
|
72
|
+
} = opts;
|
|
73
|
+
const all = [...pseudoranges.keys()].filter((p) => ephemerides.has(p));
|
|
74
|
+
const minSats = (list) => 3 + new Set(list.map((p) => p[0])).size;
|
|
75
|
+
if (all.length < minSats(all)) return null;
|
|
76
|
+
const gaussNewton = (prns) => {
|
|
77
|
+
const systems = [...new Set(prns.map((p) => p[0]))].sort();
|
|
78
|
+
const dim = 3 + systems.length;
|
|
79
|
+
const sysIndex = new Map(systems.map((s, i) => [s, 3 + i]));
|
|
80
|
+
let x2 = 0;
|
|
81
|
+
let y2 = 0;
|
|
82
|
+
let z2 = 0;
|
|
83
|
+
const clock2 = new Map(systems.map((s) => [s, 0]));
|
|
84
|
+
const residuals2 = {};
|
|
85
|
+
let iterations2 = 0;
|
|
86
|
+
let converged2 = false;
|
|
87
|
+
for (let iter = 0; iter < maxIterations; iter++) {
|
|
88
|
+
iterations2 = iter + 1;
|
|
89
|
+
const HtH = Array.from(
|
|
90
|
+
{ length: dim },
|
|
91
|
+
() => new Array(dim).fill(0)
|
|
92
|
+
);
|
|
93
|
+
const Htv = new Array(dim).fill(0);
|
|
94
|
+
let rows = 0;
|
|
95
|
+
for (const k of Object.keys(residuals2)) delete residuals2[k];
|
|
96
|
+
for (const prn of prns) {
|
|
97
|
+
const psr = pseudoranges.get(prn);
|
|
98
|
+
const eph = ephemerides.get(prn);
|
|
99
|
+
const sys = prn[0];
|
|
100
|
+
const clk = clock2.get(sys);
|
|
101
|
+
const tTx = timeMs - psr / C_LIGHT * 1e3;
|
|
102
|
+
const dtsClock = satClockCorrection(eph, tTx);
|
|
103
|
+
const sat = computeSatPosition(eph, tTx - dtsClock * 1e3);
|
|
104
|
+
if (!Number.isFinite(sat.x)) continue;
|
|
105
|
+
const isKepler = eph.system !== "R" && eph.system !== "S";
|
|
106
|
+
const dts = dtsClock - (tgd && isKepler ? eph.tgd : 0);
|
|
107
|
+
const travel = Math.hypot(sat.x - x2, sat.y - y2, sat.z - z2) / C_LIGHT;
|
|
108
|
+
const [sx, sy, sz] = sagnac(sat, travel);
|
|
109
|
+
const rho = Math.hypot(sx - x2, sy - y2, sz - z2);
|
|
110
|
+
const ux = (x2 - sx) / rho;
|
|
111
|
+
const uy = (y2 - sy) / rho;
|
|
112
|
+
const uz = (z2 - sz) / rho;
|
|
113
|
+
let elev = Math.PI / 2;
|
|
114
|
+
let weight = 1;
|
|
115
|
+
const positionSane = x2 * x2 + y2 * y2 + z2 * z2 > 1e12;
|
|
116
|
+
if (positionSane) {
|
|
117
|
+
const azel = ecefToAzEl(x2, y2, z2, sx, sy, sz);
|
|
118
|
+
elev = azel.el;
|
|
119
|
+
if (iter >= 2 && elev < elevationMaskDeg * Math.PI / 180) continue;
|
|
120
|
+
const sinEl = Math.max(Math.sin(elev), 0.1);
|
|
121
|
+
weight = sinEl * sinEl;
|
|
122
|
+
}
|
|
123
|
+
const tropo = troposphere && positionSane ? tropoDelay(elev) : 0;
|
|
124
|
+
const predicted = rho + clk - C_LIGHT * dts + tropo;
|
|
125
|
+
const v = psr - predicted;
|
|
126
|
+
const h = new Array(dim).fill(0);
|
|
127
|
+
h[0] = ux;
|
|
128
|
+
h[1] = uy;
|
|
129
|
+
h[2] = uz;
|
|
130
|
+
h[sysIndex.get(sys)] = 1;
|
|
131
|
+
for (let i = 0; i < dim; i++) {
|
|
132
|
+
for (let j = 0; j < dim; j++) HtH[i][j] += weight * h[i] * h[j];
|
|
133
|
+
Htv[i] += weight * h[i] * v;
|
|
134
|
+
}
|
|
135
|
+
residuals2[prn] = v;
|
|
136
|
+
rows++;
|
|
137
|
+
}
|
|
138
|
+
if (rows < dim) return null;
|
|
139
|
+
const dx = solveLinear(HtH, Htv);
|
|
140
|
+
if (!dx) return null;
|
|
141
|
+
x2 += dx[0];
|
|
142
|
+
y2 += dx[1];
|
|
143
|
+
z2 += dx[2];
|
|
144
|
+
for (const s of systems)
|
|
145
|
+
clock2.set(s, clock2.get(s) + dx[sysIndex.get(s)]);
|
|
146
|
+
if (Math.hypot(dx[0], dx[1], dx[2]) < convergenceM) {
|
|
147
|
+
converged2 = true;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return { x: x2, y: y2, z: z2, clock: clock2, residuals: residuals2, iterations: iterations2, converged: converged2 };
|
|
152
|
+
};
|
|
153
|
+
const REJECT_THRESHOLD_M = 50;
|
|
154
|
+
let candidates = all;
|
|
155
|
+
const rejected = [];
|
|
156
|
+
let inner = null;
|
|
157
|
+
for (let round = 0; round <= all.length; round++) {
|
|
158
|
+
inner = gaussNewton(candidates);
|
|
159
|
+
if (!inner) return null;
|
|
160
|
+
const vals = Object.entries(inner.residuals);
|
|
161
|
+
let worst = null;
|
|
162
|
+
let worstAbs = REJECT_THRESHOLD_M;
|
|
163
|
+
for (const [prn, v] of vals) {
|
|
164
|
+
if (Math.abs(v) > worstAbs) {
|
|
165
|
+
worstAbs = Math.abs(v);
|
|
166
|
+
worst = prn;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (!worst) break;
|
|
170
|
+
const remaining = candidates.filter((p) => p !== worst);
|
|
171
|
+
if (remaining.length < minSats(remaining)) break;
|
|
172
|
+
rejected.push(worst);
|
|
173
|
+
candidates = remaining;
|
|
174
|
+
}
|
|
175
|
+
if (!inner) return null;
|
|
176
|
+
const { x, y, z, clock, residuals, iterations, converged } = inner;
|
|
177
|
+
const used = [];
|
|
178
|
+
const azels = [];
|
|
179
|
+
for (const prn of candidates) {
|
|
180
|
+
if (!(prn in residuals)) continue;
|
|
181
|
+
const eph = ephemerides.get(prn);
|
|
182
|
+
const sat = computeSatPosition(eph, timeMs);
|
|
183
|
+
if (!Number.isFinite(sat.x)) continue;
|
|
184
|
+
const azel = ecefToAzEl(x, y, z, sat.x, sat.y, sat.z);
|
|
185
|
+
if (azel.el >= elevationMaskDeg * Math.PI / 180) {
|
|
186
|
+
used.push(prn);
|
|
187
|
+
azels.push(azel);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
position: [x, y, z],
|
|
192
|
+
clockBias: Object.fromEntries(clock),
|
|
193
|
+
usedSatellites: used,
|
|
194
|
+
rejectedSatellites: rejected,
|
|
195
|
+
residuals,
|
|
196
|
+
dop: computeDop(azels),
|
|
197
|
+
iterations,
|
|
198
|
+
converged
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export {
|
|
203
|
+
satClockCorrection,
|
|
204
|
+
ionoFree,
|
|
205
|
+
solveSpp
|
|
206
|
+
};
|
package/dist/constants.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(constants_exports, {
|
|
|
42
42
|
MILLISECONDS_IN_SECOND: () => MILLISECONDS_IN_SECOND,
|
|
43
43
|
MILLISECONDS_IN_WEEK: () => MILLISECONDS_IN_WEEK,
|
|
44
44
|
MILLISECONDS_TT_TAI: () => MILLISECONDS_TT_TAI,
|
|
45
|
+
OMEGA_E: () => OMEGA_E,
|
|
45
46
|
RINEX_CODES: () => RINEX_CODES,
|
|
46
47
|
SECONDS_IN_DAY: () => SECONDS_IN_DAY,
|
|
47
48
|
SECONDS_IN_HOUR: () => SECONDS_IN_HOUR,
|
|
@@ -146,6 +147,7 @@ var SYS_SHORT = {
|
|
|
146
147
|
S: "SBS"
|
|
147
148
|
};
|
|
148
149
|
var C_LIGHT = 299792458;
|
|
150
|
+
var OMEGA_E = 72921151467e-15;
|
|
149
151
|
var FREQ = {
|
|
150
152
|
G: { "1": 157542e4, "2": 12276e5, "5": 117645e4 },
|
|
151
153
|
// R bands 4/6 are the CDMA L1OC/L2OC center frequencies
|
|
@@ -396,6 +398,7 @@ function formatUTCTime(d) {
|
|
|
396
398
|
MILLISECONDS_IN_SECOND,
|
|
397
399
|
MILLISECONDS_IN_WEEK,
|
|
398
400
|
MILLISECONDS_TT_TAI,
|
|
401
|
+
OMEGA_E,
|
|
399
402
|
RINEX_CODES,
|
|
400
403
|
SECONDS_IN_DAY,
|
|
401
404
|
SECONDS_IN_HOUR,
|
package/dist/constants.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { D as DAYS_MJD2000_MJD, a as DAYS_MJD_JULIAN, M as MILLISECONDS_GPS_TAI, b as MILLISECONDS_IN_DAY, c as MILLISECONDS_IN_HOUR, d as MILLISECONDS_IN_MINUTE, e as MILLISECONDS_IN_SECOND, f as MILLISECONDS_IN_WEEK, g as MILLISECONDS_TT_TAI, R as RINEX_CODES, S as SECONDS_IN_DAY, h as SECONDS_IN_HOUR, i as SECONDS_IN_MINUTE, j as SECONDS_IN_WEEK, k as START_BDS_TIME, l as START_GAL_TIME, m as START_GLO_LEAP, n as START_GPS_TIME, o as START_JULIAN_TAI, p as START_MJD_UNIX_SECONDS, q as START_NTP_TIME, r as START_TAI_TIME, s as START_UNIX_TIME } from './time-DnI1VpE8.cjs';
|
|
2
|
-
export { A as ARC_GAP_FACTOR, B as BAND_LABELS, a as BDS_SATELLITES, b as BdsSatellite, C as C_LIGHT, D as DEFAULT_ELEV_MASK_DEG, c as DUAL_FREQ_PAIRS, F as FREQ, G as GLO_CHANNEL_FALLBACK, d as GLO_F1_BASE, e as GLO_F1_STEP, f as GLO_F2_BASE, g as GLO_F2_STEP, h as GLO_F3, O as OnSlipDetected, S as SYSTEM_NAMES,
|
|
2
|
+
export { A as ARC_GAP_FACTOR, B as BAND_LABELS, a as BDS_SATELLITES, b as BdsSatellite, C as C_LIGHT, D as DEFAULT_ELEV_MASK_DEG, c as DUAL_FREQ_PAIRS, F as FREQ, G as GLO_CHANNEL_FALLBACK, d as GLO_F1_BASE, e as GLO_F1_STEP, f as GLO_F2_BASE, g as GLO_F2_STEP, h as GLO_F3, O as OMEGA_E, i as OnSlipDetected, S as SYSTEM_NAMES, j as SYS_SHORT, k as buildGloChannelMap, l as buildObsIndices, m as formatUTCTime, n as getFreq, o as gloFreq } from './gnss-BtXrG3zH.cjs';
|
|
3
3
|
import './parser-JPjjFgeP.cjs';
|
|
4
4
|
|
|
5
5
|
/** WGS84 semi-major axis in meters. */
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { D as DAYS_MJD2000_MJD, a as DAYS_MJD_JULIAN, M as MILLISECONDS_GPS_TAI, b as MILLISECONDS_IN_DAY, c as MILLISECONDS_IN_HOUR, d as MILLISECONDS_IN_MINUTE, e as MILLISECONDS_IN_SECOND, f as MILLISECONDS_IN_WEEK, g as MILLISECONDS_TT_TAI, R as RINEX_CODES, S as SECONDS_IN_DAY, h as SECONDS_IN_HOUR, i as SECONDS_IN_MINUTE, j as SECONDS_IN_WEEK, k as START_BDS_TIME, l as START_GAL_TIME, m as START_GLO_LEAP, n as START_GPS_TIME, o as START_JULIAN_TAI, p as START_MJD_UNIX_SECONDS, q as START_NTP_TIME, r as START_TAI_TIME, s as START_UNIX_TIME } from './time-DnI1VpE8.js';
|
|
2
|
-
export { A as ARC_GAP_FACTOR, B as BAND_LABELS, a as BDS_SATELLITES, b as BdsSatellite, C as C_LIGHT, D as DEFAULT_ELEV_MASK_DEG, c as DUAL_FREQ_PAIRS, F as FREQ, G as GLO_CHANNEL_FALLBACK, d as GLO_F1_BASE, e as GLO_F1_STEP, f as GLO_F2_BASE, g as GLO_F2_STEP, h as GLO_F3, O as OnSlipDetected, S as SYSTEM_NAMES,
|
|
2
|
+
export { A as ARC_GAP_FACTOR, B as BAND_LABELS, a as BDS_SATELLITES, b as BdsSatellite, C as C_LIGHT, D as DEFAULT_ELEV_MASK_DEG, c as DUAL_FREQ_PAIRS, F as FREQ, G as GLO_CHANNEL_FALLBACK, d as GLO_F1_BASE, e as GLO_F1_STEP, f as GLO_F2_BASE, g as GLO_F2_STEP, h as GLO_F3, O as OMEGA_E, i as OnSlipDetected, S as SYSTEM_NAMES, j as SYS_SHORT, k as buildGloChannelMap, l as buildObsIndices, m as formatUTCTime, n as getFreq, o as gloFreq } from './gnss-DhnEr0Dy.js';
|
|
3
3
|
import './parser-JPjjFgeP.js';
|
|
4
4
|
|
|
5
5
|
/** WGS84 semi-major axis in meters. */
|
package/dist/constants.js
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
GLO_F2_BASE,
|
|
45
45
|
GLO_F2_STEP,
|
|
46
46
|
GLO_F3,
|
|
47
|
+
OMEGA_E,
|
|
47
48
|
SYSTEM_NAMES,
|
|
48
49
|
SYS_SHORT,
|
|
49
50
|
buildGloChannelMap,
|
|
@@ -51,7 +52,7 @@ import {
|
|
|
51
52
|
formatUTCTime,
|
|
52
53
|
getFreq,
|
|
53
54
|
gloFreq
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-FIEWO4J4.js";
|
|
55
56
|
export {
|
|
56
57
|
ARC_GAP_FACTOR,
|
|
57
58
|
BAND_LABELS,
|
|
@@ -75,6 +76,7 @@ export {
|
|
|
75
76
|
MILLISECONDS_IN_SECOND,
|
|
76
77
|
MILLISECONDS_IN_WEEK,
|
|
77
78
|
MILLISECONDS_TT_TAI,
|
|
79
|
+
OMEGA_E,
|
|
78
80
|
RINEX_CODES,
|
|
79
81
|
SECONDS_IN_DAY,
|
|
80
82
|
SECONDS_IN_HOUR,
|
package/dist/frames.js
CHANGED
|
@@ -1,219 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ITRF2005: H([2.7, 0.1, -1.4], 0.65, Z, [0.3, -0.1, 0.1], 0.03, Z, 2015),
|
|
8
|
-
ITRF2000: H([-0.2, 0.8, -34.2], 2.25, Z, [0.1, 0, -1.7], 0.11, Z, 2015),
|
|
9
|
-
ITRF97: H(
|
|
10
|
-
[6.5, -3.9, -77.9],
|
|
11
|
-
3.98,
|
|
12
|
-
[0, 0, 0.36],
|
|
13
|
-
[0.1, -0.6, -3.1],
|
|
14
|
-
0.12,
|
|
15
|
-
[0, 0, 0.02],
|
|
16
|
-
2015
|
|
17
|
-
),
|
|
18
|
-
ITRF96: H(
|
|
19
|
-
[6.5, -3.9, -77.9],
|
|
20
|
-
3.98,
|
|
21
|
-
[0, 0, 0.36],
|
|
22
|
-
[0.1, -0.6, -3.1],
|
|
23
|
-
0.12,
|
|
24
|
-
[0, 0, 0.02],
|
|
25
|
-
2015
|
|
26
|
-
),
|
|
27
|
-
ITRF94: H(
|
|
28
|
-
[6.5, -3.9, -77.9],
|
|
29
|
-
3.98,
|
|
30
|
-
[0, 0, 0.36],
|
|
31
|
-
[0.1, -0.6, -3.1],
|
|
32
|
-
0.12,
|
|
33
|
-
[0, 0, 0.02],
|
|
34
|
-
2015
|
|
35
|
-
),
|
|
36
|
-
ITRF93: H(
|
|
37
|
-
[-65.8, 1.9, -71.3],
|
|
38
|
-
4.47,
|
|
39
|
-
[-3.36, -4.33, 0.75],
|
|
40
|
-
[-2.8, -0.2, -2.3],
|
|
41
|
-
0.12,
|
|
42
|
-
[-0.11, -0.19, 0.07],
|
|
43
|
-
2015
|
|
44
|
-
),
|
|
45
|
-
ITRF92: H(
|
|
46
|
-
[14.5, -1.9, -85.9],
|
|
47
|
-
3.27,
|
|
48
|
-
[0, 0, 0.36],
|
|
49
|
-
[0.1, -0.6, -3.1],
|
|
50
|
-
0.12,
|
|
51
|
-
[0, 0, 0.02],
|
|
52
|
-
2015
|
|
53
|
-
),
|
|
54
|
-
ITRF91: H(
|
|
55
|
-
[26.5, 12.1, -91.9],
|
|
56
|
-
4.67,
|
|
57
|
-
[0, 0, 0.36],
|
|
58
|
-
[0.1, -0.6, -3.1],
|
|
59
|
-
0.12,
|
|
60
|
-
[0, 0, 0.02],
|
|
61
|
-
2015
|
|
62
|
-
),
|
|
63
|
-
ITRF90: H(
|
|
64
|
-
[24.5, 8.1, -107.9],
|
|
65
|
-
4.97,
|
|
66
|
-
[0, 0, 0.36],
|
|
67
|
-
[0.1, -0.6, -3.1],
|
|
68
|
-
0.12,
|
|
69
|
-
[0, 0, 0.02],
|
|
70
|
-
2015
|
|
71
|
-
),
|
|
72
|
-
ITRF89: H(
|
|
73
|
-
[29.5, 32.1, -145.9],
|
|
74
|
-
8.37,
|
|
75
|
-
[0, 0, 0.36],
|
|
76
|
-
[0.1, -0.6, -3.1],
|
|
77
|
-
0.12,
|
|
78
|
-
[0, 0, 0.02],
|
|
79
|
-
2015
|
|
80
|
-
),
|
|
81
|
-
ITRF88: H(
|
|
82
|
-
[24.5, -3.9, -169.9],
|
|
83
|
-
11.47,
|
|
84
|
-
[0.1, 0, 0.36],
|
|
85
|
-
[0.1, -0.6, -3.1],
|
|
86
|
-
0.12,
|
|
87
|
-
[0, 0, 0.02],
|
|
88
|
-
2015
|
|
89
|
-
),
|
|
90
|
-
/** ITRF2020 → ETRF2020, EPSG:10572 (epoch-1989 variant) */
|
|
91
|
-
ETRF2020: H(Z, 0, Z, Z, 0, [0.086, 0.519, -0.753], 1989)
|
|
92
|
-
};
|
|
93
|
-
var ITRF2014_TO_ETRF2014 = H(Z, 0, Z, Z, 0, [0.085, 0.531, -0.77], 1989);
|
|
94
|
-
var ITRF2014_TO_ETRF2000 = H(
|
|
95
|
-
[54.7, 52.2, -74.1],
|
|
96
|
-
2.12,
|
|
97
|
-
[1.701, 10.29, -16.632],
|
|
98
|
-
[0.1, 0.1, -1.9],
|
|
99
|
-
0.11,
|
|
100
|
-
[0.081, 0.49, -0.792],
|
|
101
|
-
2010
|
|
102
|
-
);
|
|
103
|
-
var ITRF2014_TO_NAD83_2011 = H(
|
|
104
|
-
[1005.3, -1909.21, -541.57],
|
|
105
|
-
0.36891,
|
|
106
|
-
[-26.78138, 0.42027, -10.93206],
|
|
107
|
-
[0.79, -0.6, -1.44],
|
|
108
|
-
-0.07201,
|
|
109
|
-
[-0.06667, 0.75744, 0.05133],
|
|
110
|
-
2010
|
|
111
|
-
);
|
|
112
|
-
var MAS_TO_RAD = Math.PI / (180 * 3600 * 1e3);
|
|
113
|
-
function applyHelmert(xyz, p, epoch, inverse = false) {
|
|
114
|
-
const dt = epoch - p.epoch;
|
|
115
|
-
const sign = inverse ? -1 : 1;
|
|
116
|
-
const tx = sign * (p.t[0] + p.tDot[0] * dt) / 1e3;
|
|
117
|
-
const ty = sign * (p.t[1] + p.tDot[1] * dt) / 1e3;
|
|
118
|
-
const tz = sign * (p.t[2] + p.tDot[2] * dt) / 1e3;
|
|
119
|
-
const d = sign * (p.d + p.dDot * dt) * 1e-9;
|
|
120
|
-
const rx = sign * (p.r[0] + p.rDot[0] * dt) * MAS_TO_RAD;
|
|
121
|
-
const ry = sign * (p.r[1] + p.rDot[1] * dt) * MAS_TO_RAD;
|
|
122
|
-
const rz = sign * (p.r[2] + p.rDot[2] * dt) * MAS_TO_RAD;
|
|
123
|
-
const [x, y, z] = xyz;
|
|
124
|
-
return [
|
|
125
|
-
x + tx + d * x - rz * y + ry * z,
|
|
126
|
-
y + ty + rz * x + d * y - rx * z,
|
|
127
|
-
z + tz - ry * x + rx * y + d * z
|
|
128
|
-
];
|
|
129
|
-
}
|
|
130
|
-
var EDGES = [
|
|
131
|
-
...Object.entries(FROM_ITRF2020).map(([to, p]) => ({
|
|
132
|
-
from: "ITRF2020",
|
|
133
|
-
to,
|
|
134
|
-
p
|
|
135
|
-
})),
|
|
136
|
-
{ from: "ITRF2014", to: "ETRF2014", p: ITRF2014_TO_ETRF2014 },
|
|
137
|
-
{ from: "ITRF2014", to: "ETRF2000", p: ITRF2014_TO_ETRF2000 },
|
|
138
|
-
{ from: "ITRF2014", to: "NAD83(2011)", p: ITRF2014_TO_NAD83_2011 }
|
|
139
|
-
];
|
|
140
|
-
var REFERENCE_FRAMES = [
|
|
141
|
-
"WGS84",
|
|
142
|
-
"ITRF2020",
|
|
143
|
-
"ITRF2014",
|
|
144
|
-
"ITRF2008",
|
|
145
|
-
"ITRF2005",
|
|
146
|
-
"ITRF2000",
|
|
147
|
-
"ITRF97",
|
|
148
|
-
"ITRF96",
|
|
149
|
-
"ITRF94",
|
|
150
|
-
"ITRF93",
|
|
151
|
-
"ITRF92",
|
|
152
|
-
"ITRF91",
|
|
153
|
-
"ITRF90",
|
|
154
|
-
"ITRF89",
|
|
155
|
-
"ITRF88",
|
|
156
|
-
"ETRF2020",
|
|
157
|
-
"ETRF2014",
|
|
158
|
-
"ETRF2000",
|
|
159
|
-
"NAD83(2011)"
|
|
160
|
-
];
|
|
161
|
-
function resolveAlias(f) {
|
|
162
|
-
return f === "WGS84" ? "ITRF2020" : f;
|
|
163
|
-
}
|
|
164
|
-
function findPath(from, to) {
|
|
165
|
-
if (from === to) return [];
|
|
166
|
-
const queue = [from];
|
|
167
|
-
const cameFrom = /* @__PURE__ */ new Map();
|
|
168
|
-
const seen = /* @__PURE__ */ new Set([from]);
|
|
169
|
-
while (queue.length > 0) {
|
|
170
|
-
const cur = queue.shift();
|
|
171
|
-
for (const edge of EDGES) {
|
|
172
|
-
let next = null;
|
|
173
|
-
let inverse = false;
|
|
174
|
-
if (edge.from === cur) {
|
|
175
|
-
next = edge.to;
|
|
176
|
-
} else if (edge.to === cur) {
|
|
177
|
-
next = edge.from;
|
|
178
|
-
inverse = true;
|
|
179
|
-
}
|
|
180
|
-
if (next === null || seen.has(next)) continue;
|
|
181
|
-
seen.add(next);
|
|
182
|
-
cameFrom.set(next, { prev: cur, edge, inverse });
|
|
183
|
-
if (next === to) {
|
|
184
|
-
const path = [];
|
|
185
|
-
let node = to;
|
|
186
|
-
while (node !== from) {
|
|
187
|
-
const step = cameFrom.get(node);
|
|
188
|
-
path.unshift({ edge: step.edge, inverse: step.inverse });
|
|
189
|
-
node = step.prev;
|
|
190
|
-
}
|
|
191
|
-
return path;
|
|
192
|
-
}
|
|
193
|
-
queue.push(next);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
function transformFrame(xyz, from, to, epoch) {
|
|
199
|
-
const src = resolveAlias(from);
|
|
200
|
-
const dst = resolveAlias(to);
|
|
201
|
-
const path = findPath(src, dst);
|
|
202
|
-
if (!path) {
|
|
203
|
-
throw new Error(`No transformation path from ${from} to ${to}`);
|
|
204
|
-
}
|
|
205
|
-
let out = [xyz[0], xyz[1], xyz[2]];
|
|
206
|
-
for (const { edge, inverse } of path) {
|
|
207
|
-
out = applyHelmert(out, edge.p, epoch, inverse);
|
|
208
|
-
}
|
|
209
|
-
return out;
|
|
210
|
-
}
|
|
211
|
-
function dateToEpoch(date) {
|
|
212
|
-
const year = date.getUTCFullYear();
|
|
213
|
-
const start = Date.UTC(year, 0, 1);
|
|
214
|
-
const end = Date.UTC(year + 1, 0, 1);
|
|
215
|
-
return year + (date.getTime() - start) / (end - start);
|
|
216
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
REFERENCE_FRAMES,
|
|
3
|
+
applyHelmert,
|
|
4
|
+
dateToEpoch,
|
|
5
|
+
transformFrame
|
|
6
|
+
} from "./chunk-4KOXMHUW.js";
|
|
217
7
|
export {
|
|
218
8
|
REFERENCE_FRAMES,
|
|
219
9
|
applyHelmert,
|
|
@@ -9,6 +9,8 @@ declare const SYSTEM_NAMES: Record<string, string>;
|
|
|
9
9
|
declare const SYS_SHORT: Record<string, string>;
|
|
10
10
|
/** Speed of light in m/s. */
|
|
11
11
|
declare const C_LIGHT = 299792458;
|
|
12
|
+
/** Earth rotation rate in rad/s (WGS84/PZ-90 value). */
|
|
13
|
+
declare const OMEGA_E = 0.000072921151467;
|
|
12
14
|
/** Carrier frequencies (Hz) per system letter, per RINEX band digit. GLONASS FDMA bands 1/2 use gloFreq(). */
|
|
13
15
|
declare const FREQ: Record<string, Record<string, number>>;
|
|
14
16
|
declare const BAND_LABELS: Record<string, Record<string, string>>;
|
|
@@ -53,4 +55,4 @@ declare const DEFAULT_ELEV_MASK_DEG = 5;
|
|
|
53
55
|
/** Format a Date as HH:MM:SS UTC string. */
|
|
54
56
|
declare function formatUTCTime(d: Date): string;
|
|
55
57
|
|
|
56
|
-
export { ARC_GAP_FACTOR as A, BAND_LABELS as B, C_LIGHT as C, DEFAULT_ELEV_MASK_DEG as D, FREQ as F, GLO_CHANNEL_FALLBACK as G,
|
|
58
|
+
export { ARC_GAP_FACTOR as A, BAND_LABELS as B, C_LIGHT as C, DEFAULT_ELEV_MASK_DEG as D, FREQ as F, GLO_CHANNEL_FALLBACK as G, OMEGA_E as O, SYSTEM_NAMES as S, BDS_SATELLITES as a, type BdsSatellite as b, DUAL_FREQ_PAIRS as c, GLO_F1_BASE as d, GLO_F1_STEP as e, GLO_F2_BASE as f, GLO_F2_STEP as g, GLO_F3 as h, type OnSlipDetected as i, SYS_SHORT as j, buildGloChannelMap as k, buildObsIndices as l, formatUTCTime as m, getFreq as n, gloFreq as o };
|
|
@@ -9,6 +9,8 @@ declare const SYSTEM_NAMES: Record<string, string>;
|
|
|
9
9
|
declare const SYS_SHORT: Record<string, string>;
|
|
10
10
|
/** Speed of light in m/s. */
|
|
11
11
|
declare const C_LIGHT = 299792458;
|
|
12
|
+
/** Earth rotation rate in rad/s (WGS84/PZ-90 value). */
|
|
13
|
+
declare const OMEGA_E = 0.000072921151467;
|
|
12
14
|
/** Carrier frequencies (Hz) per system letter, per RINEX band digit. GLONASS FDMA bands 1/2 use gloFreq(). */
|
|
13
15
|
declare const FREQ: Record<string, Record<string, number>>;
|
|
14
16
|
declare const BAND_LABELS: Record<string, Record<string, string>>;
|
|
@@ -53,4 +55,4 @@ declare const DEFAULT_ELEV_MASK_DEG = 5;
|
|
|
53
55
|
/** Format a Date as HH:MM:SS UTC string. */
|
|
54
56
|
declare function formatUTCTime(d: Date): string;
|
|
55
57
|
|
|
56
|
-
export { ARC_GAP_FACTOR as A, BAND_LABELS as B, C_LIGHT as C, DEFAULT_ELEV_MASK_DEG as D, FREQ as F, GLO_CHANNEL_FALLBACK as G,
|
|
58
|
+
export { ARC_GAP_FACTOR as A, BAND_LABELS as B, C_LIGHT as C, DEFAULT_ELEV_MASK_DEG as D, FREQ as F, GLO_CHANNEL_FALLBACK as G, OMEGA_E as O, SYSTEM_NAMES as S, BDS_SATELLITES as a, type BdsSatellite as b, DUAL_FREQ_PAIRS as c, GLO_F1_BASE as d, GLO_F1_STEP as e, GLO_F2_BASE as f, GLO_F2_STEP as g, GLO_F3 as h, type OnSlipDetected as i, SYS_SHORT as j, buildGloChannelMap as k, buildObsIndices as l, formatUTCTime as m, getFreq as n, gloFreq as o };
|