gnss-js 1.45.0 → 1.45.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.
@@ -1102,12 +1102,23 @@ var RtkFloatEngine = class {
1102
1102
 
1103
1103
  // src/positioning/rtk-postprocess.ts
1104
1104
  var epochsOf = (o) => Array.isArray(o) ? o : o.epochs;
1105
+ function medianIntervalMs(epochs) {
1106
+ const times = [...new Set(epochs.map((e) => e.timeMs))].sort((a, b) => a - b);
1107
+ if (times.length < 2) return null;
1108
+ const gaps = [];
1109
+ for (let i = 1; i < times.length; i++) gaps.push(times[i] - times[i - 1]);
1110
+ gaps.sort((a, b) => a - b);
1111
+ return gaps[Math.floor(gaps.length / 2)];
1112
+ }
1105
1113
  function postProcessRtk(base, rover, ephemerides, baseEcef, opts = {}) {
1106
1114
  const tol = opts.pairToleranceMs ?? 500;
1107
1115
  const round = (ms) => Math.round(ms / 1e3) * 1e3;
1116
+ const roverEpochs = epochsOf(rover);
1117
+ const interval = medianIntervalMs(roverEpochs);
1118
+ const engineOpts = opts.maxGapMs != null || interval == null ? opts : { ...opts, maxGapMs: Math.max(1e4, Math.round(interval * 2.5)) };
1108
1119
  const baseByT = /* @__PURE__ */ new Map();
1109
1120
  for (const e of epochsOf(base)) baseByT.set(round(e.timeMs), e);
1110
- const engine = new RtkFloatEngine(baseEcef, ephemerides, opts);
1121
+ const engine = new RtkFloatEngine(baseEcef, ephemerides, engineOpts);
1111
1122
  const [bLat, bLon] = ecefToGeodetic(baseEcef[0], baseEcef[1], baseEcef[2]);
1112
1123
  const [sLat, cLat, sLon, cLon] = [
1113
1124
  Math.sin(bLat),
@@ -1130,7 +1141,7 @@ function postProcessRtk(base, rover, ephemerides, baseEcef, opts = {}) {
1130
1141
  let solved = 0;
1131
1142
  let unmatched = 0;
1132
1143
  let fixed = 0;
1133
- const sorted = [...epochsOf(rover)].sort((a, b) => a.timeMs - b.timeMs);
1144
+ const sorted = [...roverEpochs].sort((a, b) => a.timeMs - b.timeMs);
1134
1145
  for (const rEp of sorted) {
1135
1146
  if (seen.has(rEp.timeMs)) continue;
1136
1147
  seen.add(rEp.timeMs);
package/dist/index.cjs CHANGED
@@ -13035,12 +13035,23 @@ var RtkFloatEngine = class {
13035
13035
 
13036
13036
  // src/positioning/rtk-postprocess.ts
13037
13037
  var epochsOf = (o) => Array.isArray(o) ? o : o.epochs;
13038
+ function medianIntervalMs(epochs) {
13039
+ const times = [...new Set(epochs.map((e) => e.timeMs))].sort((a, b) => a - b);
13040
+ if (times.length < 2) return null;
13041
+ const gaps = [];
13042
+ for (let i = 1; i < times.length; i++) gaps.push(times[i] - times[i - 1]);
13043
+ gaps.sort((a, b) => a - b);
13044
+ return gaps[Math.floor(gaps.length / 2)];
13045
+ }
13038
13046
  function postProcessRtk(base, rover, ephemerides, baseEcef, opts = {}) {
13039
13047
  const tol = opts.pairToleranceMs ?? 500;
13040
13048
  const round = (ms) => Math.round(ms / 1e3) * 1e3;
13049
+ const roverEpochs = epochsOf(rover);
13050
+ const interval = medianIntervalMs(roverEpochs);
13051
+ const engineOpts = opts.maxGapMs != null || interval == null ? opts : { ...opts, maxGapMs: Math.max(1e4, Math.round(interval * 2.5)) };
13041
13052
  const baseByT = /* @__PURE__ */ new Map();
13042
13053
  for (const e of epochsOf(base)) baseByT.set(round(e.timeMs), e);
13043
- const engine = new RtkFloatEngine(baseEcef, ephemerides, opts);
13054
+ const engine = new RtkFloatEngine(baseEcef, ephemerides, engineOpts);
13044
13055
  const [bLat, bLon] = ecefToGeodetic(baseEcef[0], baseEcef[1], baseEcef[2]);
13045
13056
  const [sLat, cLat, sLon, cLon] = [
13046
13057
  Math.sin(bLat),
@@ -13063,7 +13074,7 @@ function postProcessRtk(base, rover, ephemerides, baseEcef, opts = {}) {
13063
13074
  let solved = 0;
13064
13075
  let unmatched = 0;
13065
13076
  let fixed = 0;
13066
- const sorted = [...epochsOf(rover)].sort((a, b) => a.timeMs - b.timeMs);
13077
+ const sorted = [...roverEpochs].sort((a, b) => a.timeMs - b.timeMs);
13067
13078
  for (const rEp of sorted) {
13068
13079
  if (seen.has(rEp.timeMs)) continue;
13069
13080
  seen.add(rEp.timeMs);
package/dist/index.js CHANGED
@@ -164,7 +164,7 @@ import {
164
164
  sunEcef,
165
165
  toRtkEpoch,
166
166
  wlWavelength
167
- } from "./chunk-XYCECWWS.js";
167
+ } from "./chunk-ST22ULND.js";
168
168
  import {
169
169
  almanacEpochMs,
170
170
  almanacSatPosition,
@@ -1558,12 +1558,23 @@ var RtkFloatEngine = class {
1558
1558
 
1559
1559
  // src/positioning/rtk-postprocess.ts
1560
1560
  var epochsOf = (o) => Array.isArray(o) ? o : o.epochs;
1561
+ function medianIntervalMs(epochs) {
1562
+ const times = [...new Set(epochs.map((e) => e.timeMs))].sort((a, b) => a - b);
1563
+ if (times.length < 2) return null;
1564
+ const gaps = [];
1565
+ for (let i = 1; i < times.length; i++) gaps.push(times[i] - times[i - 1]);
1566
+ gaps.sort((a, b) => a - b);
1567
+ return gaps[Math.floor(gaps.length / 2)];
1568
+ }
1561
1569
  function postProcessRtk(base, rover, ephemerides, baseEcef, opts = {}) {
1562
1570
  const tol = opts.pairToleranceMs ?? 500;
1563
1571
  const round = (ms) => Math.round(ms / 1e3) * 1e3;
1572
+ const roverEpochs = epochsOf(rover);
1573
+ const interval = medianIntervalMs(roverEpochs);
1574
+ const engineOpts = opts.maxGapMs != null || interval == null ? opts : { ...opts, maxGapMs: Math.max(1e4, Math.round(interval * 2.5)) };
1564
1575
  const baseByT = /* @__PURE__ */ new Map();
1565
1576
  for (const e of epochsOf(base)) baseByT.set(round(e.timeMs), e);
1566
- const engine = new RtkFloatEngine(baseEcef, ephemerides, opts);
1577
+ const engine = new RtkFloatEngine(baseEcef, ephemerides, engineOpts);
1567
1578
  const [bLat, bLon] = ecefToGeodetic(baseEcef[0], baseEcef[1], baseEcef[2]);
1568
1579
  const [sLat, cLat, sLon, cLon] = [
1569
1580
  Math.sin(bLat),
@@ -1586,7 +1597,7 @@ function postProcessRtk(base, rover, ephemerides, baseEcef, opts = {}) {
1586
1597
  let solved = 0;
1587
1598
  let unmatched = 0;
1588
1599
  let fixed = 0;
1589
- const sorted = [...epochsOf(rover)].sort((a, b) => a.timeMs - b.timeMs);
1600
+ const sorted = [...roverEpochs].sort((a, b) => a.timeMs - b.timeMs);
1590
1601
  for (const rEp of sorted) {
1591
1602
  if (seen.has(rEp.timeMs)) continue;
1592
1603
  seen.add(rEp.timeMs);
@@ -28,7 +28,7 @@ import {
28
28
  sunEcef,
29
29
  toRtkEpoch,
30
30
  wlWavelength
31
- } from "./chunk-XYCECWWS.js";
31
+ } from "./chunk-ST22ULND.js";
32
32
  import "./chunk-MHGNKSSH.js";
33
33
  import "./chunk-MIIM4LDY.js";
34
34
  import "./chunk-37QNKGTC.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gnss-js",
3
- "version": "1.45.0",
3
+ "version": "1.45.1",
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,