gnss-js 1.5.0 → 1.6.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 +46 -23
- package/dist/analysis.cjs +130 -28
- package/dist/analysis.d.cts +43 -3
- package/dist/analysis.d.ts +43 -3
- package/dist/analysis.js +5 -1
- package/dist/{chunk-PQYBTE42.js → chunk-CD5YSYCG.js} +11 -17
- package/dist/{chunk-65CQINSB.js → chunk-FGRC3PB3.js} +6 -2
- package/dist/{chunk-PX7TPPTQ.js → chunk-SOJNWF5T.js} +1 -1
- package/dist/{chunk-EJQ6NG5U.js → chunk-Z5UZUNCB.js} +126 -26
- package/dist/index.cjs +145 -45
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -4
- package/dist/orbit.cjs +11 -17
- package/dist/orbit.d.cts +1 -1
- package/dist/orbit.d.ts +1 -1
- package/dist/orbit.js +1 -1
- package/dist/positioning.cjs +2 -0
- package/dist/positioning.js +2 -2
- package/dist/rtcm3.cjs +6 -2
- package/dist/rtcm3.js +1 -1
- package/package.json +7 -7
package/dist/orbit.cjs
CHANGED
|
@@ -372,20 +372,10 @@ function invert4x4(m) {
|
|
|
372
372
|
return result;
|
|
373
373
|
}
|
|
374
374
|
function selectEphemeris(ephemerides, prn, timeMs) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const ephTime = eph.tocDate.getTime();
|
|
380
|
-
const dt = Math.abs(timeMs - ephTime);
|
|
381
|
-
const maxAge = eph.system === "R" || eph.system === "S" ? 18e5 : 4 * 36e5;
|
|
382
|
-
if (dt > maxAge) continue;
|
|
383
|
-
if (dt < bestDt) {
|
|
384
|
-
bestDt = dt;
|
|
385
|
-
best = eph;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return best;
|
|
375
|
+
return selectBest(
|
|
376
|
+
ephemerides.filter((e) => e.prn === prn),
|
|
377
|
+
timeMs
|
|
378
|
+
);
|
|
389
379
|
}
|
|
390
380
|
function computeSatPosition(eph, timeMs) {
|
|
391
381
|
if (eph.system === "R" || eph.system === "S") {
|
|
@@ -478,8 +468,9 @@ function selectBest(ephs, timeMs) {
|
|
|
478
468
|
return best;
|
|
479
469
|
}
|
|
480
470
|
var GPS_EPOCH_MS = START_GPS_TIME.getTime();
|
|
471
|
+
var MS_PER_WEEK = 7 * 864e5;
|
|
481
472
|
var BDS_EPOCH_MS = START_BDS_TIME.getTime();
|
|
482
|
-
var GAL_EPOCH_MS = GPS_EPOCH_MS;
|
|
473
|
+
var GAL_EPOCH_MS = GPS_EPOCH_MS + 1024 * MS_PER_WEEK;
|
|
483
474
|
function ephInfoToEphemeris(info) {
|
|
484
475
|
const sys = info.prn.charAt(0);
|
|
485
476
|
if (sys === "R") {
|
|
@@ -523,6 +514,7 @@ function ephInfoToEphemeris(info) {
|
|
|
523
514
|
return null;
|
|
524
515
|
}
|
|
525
516
|
let epochMs;
|
|
517
|
+
let week = info.week;
|
|
526
518
|
const tocSec = info.toc ?? info.toe;
|
|
527
519
|
if (sys === "C") {
|
|
528
520
|
epochMs = BDS_EPOCH_MS;
|
|
@@ -530,8 +522,10 @@ function ephInfoToEphemeris(info) {
|
|
|
530
522
|
epochMs = GAL_EPOCH_MS;
|
|
531
523
|
} else {
|
|
532
524
|
epochMs = GPS_EPOCH_MS;
|
|
525
|
+
const weeksNow = (info.lastReceived - GPS_EPOCH_MS) / MS_PER_WEEK;
|
|
526
|
+
week += 1024 * Math.round((weeksNow - week) / 1024);
|
|
533
527
|
}
|
|
534
|
-
const tocDate = new Date(epochMs +
|
|
528
|
+
const tocDate = new Date(epochMs + week * MS_PER_WEEK + tocSec * 1e3);
|
|
535
529
|
return {
|
|
536
530
|
system: sys,
|
|
537
531
|
prn: info.prn,
|
|
@@ -557,7 +551,7 @@ function ephInfoToEphemeris(info) {
|
|
|
557
551
|
omega: info.argPerigee,
|
|
558
552
|
omegaDot: info.omegaDot ?? 0,
|
|
559
553
|
idot: info.idot ?? 0,
|
|
560
|
-
week
|
|
554
|
+
week,
|
|
561
555
|
svHealth: info.health,
|
|
562
556
|
tgd: 0
|
|
563
557
|
};
|
package/dist/orbit.d.cts
CHANGED
|
@@ -131,7 +131,7 @@ interface VisibilityPass {
|
|
|
131
131
|
interface VisibilityResult {
|
|
132
132
|
/** Sample epochs (Unix ms). */
|
|
133
133
|
times: number[];
|
|
134
|
-
/** Elevation (radians) per PRN per epoch; null when
|
|
134
|
+
/** Elevation (radians) per PRN per epoch; null when no valid ephemeris. */
|
|
135
135
|
elevation: Record<string, (number | null)[]>;
|
|
136
136
|
/** Number of satellites at or above the mask, per epoch. */
|
|
137
137
|
visibleCount: number[];
|
package/dist/orbit.d.ts
CHANGED
|
@@ -131,7 +131,7 @@ interface VisibilityPass {
|
|
|
131
131
|
interface VisibilityResult {
|
|
132
132
|
/** Sample epochs (Unix ms). */
|
|
133
133
|
times: number[];
|
|
134
|
-
/** Elevation (radians) per PRN per epoch; null when
|
|
134
|
+
/** Elevation (radians) per PRN per epoch; null when no valid ephemeris. */
|
|
135
135
|
elevation: Record<string, (number | null)[]>;
|
|
136
136
|
/** Number of satellites at or above the mask, per epoch. */
|
|
137
137
|
visibleCount: number[];
|
package/dist/orbit.js
CHANGED
package/dist/positioning.cjs
CHANGED
|
@@ -367,7 +367,9 @@ function computeSatPosition(eph, timeMs) {
|
|
|
367
367
|
return keplerPosition(eph, tow);
|
|
368
368
|
}
|
|
369
369
|
var GPS_EPOCH_MS = START_GPS_TIME.getTime();
|
|
370
|
+
var MS_PER_WEEK = 7 * 864e5;
|
|
370
371
|
var BDS_EPOCH_MS = START_BDS_TIME.getTime();
|
|
372
|
+
var GAL_EPOCH_MS = GPS_EPOCH_MS + 1024 * MS_PER_WEEK;
|
|
371
373
|
|
|
372
374
|
// src/positioning/index.ts
|
|
373
375
|
var GM_GPS2 = 3986005e8;
|
package/dist/positioning.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
ionoFree,
|
|
3
3
|
satClockCorrection,
|
|
4
4
|
solveSpp
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-SOJNWF5T.js";
|
|
6
|
+
import "./chunk-CD5YSYCG.js";
|
|
7
7
|
import "./chunk-HVXYFUCB.js";
|
|
8
8
|
import "./chunk-37QNKGTC.js";
|
|
9
9
|
import "./chunk-6FAL6P4G.js";
|
package/dist/rtcm3.cjs
CHANGED
|
@@ -1406,6 +1406,11 @@ function rtcm3Constellation(msgType) {
|
|
|
1406
1406
|
if (msgType >= 1111 && msgType <= 1117) return "QZSS";
|
|
1407
1407
|
if (msgType >= 1121 && msgType <= 1127) return "BeiDou";
|
|
1408
1408
|
if (msgType >= 1131 && msgType <= 1137) return "NavIC";
|
|
1409
|
+
if (msgType >= 1015 && msgType <= 1017) return "GPS";
|
|
1410
|
+
if (msgType === 1030) return "GPS";
|
|
1411
|
+
if (msgType === 1031) return "GLONASS";
|
|
1412
|
+
if (msgType >= 1057 && msgType <= 1062) return "GPS";
|
|
1413
|
+
if (msgType >= 1063 && msgType <= 1068) return "GLONASS";
|
|
1409
1414
|
if (msgType === 1230) return "GLONASS";
|
|
1410
1415
|
return null;
|
|
1411
1416
|
}
|
|
@@ -1445,7 +1450,6 @@ function updateStreamStats(stats, frames, rawBytes) {
|
|
|
1445
1450
|
entry.totalBytes += frame.length + 6;
|
|
1446
1451
|
const msmEpoch = decodeMsmFull(frame);
|
|
1447
1452
|
if (msmEpoch) {
|
|
1448
|
-
const now2 = Date.now();
|
|
1449
1453
|
for (const obs of msmEpoch.observations) {
|
|
1450
1454
|
const signals = [];
|
|
1451
1455
|
let bestCn0 = 0;
|
|
@@ -1460,7 +1464,7 @@ function updateStreamStats(stats, frames, rawBytes) {
|
|
|
1460
1464
|
prn: obs.prn,
|
|
1461
1465
|
system: obs.system,
|
|
1462
1466
|
cn0: bestCn0,
|
|
1463
|
-
lastSeen:
|
|
1467
|
+
lastSeen: now,
|
|
1464
1468
|
signals
|
|
1465
1469
|
});
|
|
1466
1470
|
}
|
package/dist/rtcm3.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gnss-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Comprehensive GNSS library for JavaScript — time scales, coordinates, RINEX parsing, RTCM3 decoding, orbit computation, and signal analysis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
"positioning"
|
|
107
107
|
],
|
|
108
108
|
"author": "Miguel González <work@miguel.es>",
|
|
109
|
-
"license": "AGPL-3.0-only",
|
|
109
|
+
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
110
110
|
"repository": {
|
|
111
111
|
"type": "git",
|
|
112
|
-
"url": "https://github.com/MiguelPuntoEs/gnss-js"
|
|
112
|
+
"url": "git+https://github.com/MiguelPuntoEs/gnss-js.git"
|
|
113
113
|
},
|
|
114
114
|
"homepage": "https://github.com/MiguelPuntoEs/gnss-js#readme",
|
|
115
115
|
"bugs": {
|
|
@@ -118,14 +118,14 @@
|
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@eslint/js": "^10.0.1",
|
|
120
120
|
"@types/node": "^20.11.17",
|
|
121
|
-
"eslint": "^10.
|
|
121
|
+
"eslint": "^10.7.0",
|
|
122
122
|
"husky": "^9.1.7",
|
|
123
123
|
"lint-staged": "^16.4.0",
|
|
124
|
-
"prettier": "^3.5
|
|
124
|
+
"prettier": "^3.9.5",
|
|
125
125
|
"tsup": "^8.0.2",
|
|
126
126
|
"typescript": "^5.8.3",
|
|
127
|
-
"typescript-eslint": "^8.
|
|
128
|
-
"vitest": "^4.
|
|
127
|
+
"typescript-eslint": "^8.64.0",
|
|
128
|
+
"vitest": "^4.1.10"
|
|
129
129
|
},
|
|
130
130
|
"lint-staged": {
|
|
131
131
|
"*.{ts,js}": [
|