gnss-js 0.1.2 → 1.0.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.
Files changed (87) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +171 -5
  3. package/dist/analysis.cjs +1381 -0
  4. package/dist/analysis.d.cts +211 -0
  5. package/dist/analysis.d.ts +211 -0
  6. package/dist/analysis.js +14 -0
  7. package/dist/antex.cjs +239 -0
  8. package/dist/antex.d.cts +77 -0
  9. package/dist/antex.d.ts +77 -0
  10. package/dist/antex.js +8 -0
  11. package/dist/chunk-354IRDOG.js +239 -0
  12. package/dist/chunk-37QNKGTC.js +65 -0
  13. package/dist/chunk-5CMSYIYM.js +214 -0
  14. package/dist/chunk-5S5MONFK.js +0 -0
  15. package/dist/chunk-6FAL6P4G.js +12 -0
  16. package/dist/chunk-7NOFXKET.js +433 -0
  17. package/dist/chunk-CB6EOOLA.js +753 -0
  18. package/dist/chunk-HKN3PUGN.js +800 -0
  19. package/dist/chunk-IS4UUDBV.js +577 -0
  20. package/dist/chunk-K7WZQFBV.js +236 -0
  21. package/dist/chunk-LEEU5OIO.js +75 -0
  22. package/dist/chunk-PRSZIWKM.js +1482 -0
  23. package/dist/chunk-SDRRAJT5.js +433 -0
  24. package/dist/chunk-WR7LCB52.js +143 -0
  25. package/dist/chunk-Y3R57B5P.js +473 -0
  26. package/dist/chunk-YDMYO3YK.js +220 -0
  27. package/dist/constants.cjs +394 -0
  28. package/dist/constants.d.cts +14 -0
  29. package/dist/constants.d.ts +14 -0
  30. package/dist/constants.js +103 -0
  31. package/dist/coordinates.cjs +334 -0
  32. package/dist/coordinates.d.cts +81 -0
  33. package/dist/coordinates.d.ts +81 -0
  34. package/dist/coordinates.js +39 -0
  35. package/dist/ecef-CF0uAysr.d.cts +40 -0
  36. package/dist/ecef-CF0uAysr.d.ts +40 -0
  37. package/dist/ephemeris-BUWzfmBy.d.cts +114 -0
  38. package/dist/ephemeris-BUWzfmBy.d.ts +114 -0
  39. package/dist/gnss-BT6ulR17.d.cts +56 -0
  40. package/dist/gnss-C-tgoYNa.d.ts +56 -0
  41. package/dist/index.cjs +5774 -78
  42. package/dist/index.d.cts +17 -96
  43. package/dist/index.d.ts +17 -96
  44. package/dist/index.js +352 -415
  45. package/dist/nav-BAI1a9vK.d.cts +108 -0
  46. package/dist/nav-BAI1a9vK.d.ts +108 -0
  47. package/dist/nmea.cjs +247 -0
  48. package/dist/nmea.d.cts +37 -0
  49. package/dist/nmea.d.ts +37 -0
  50. package/dist/nmea.js +12 -0
  51. package/dist/ntrip.cjs +169 -0
  52. package/dist/ntrip.d.cts +98 -0
  53. package/dist/ntrip.d.ts +98 -0
  54. package/dist/ntrip.js +10 -0
  55. package/dist/orbit.cjs +504 -0
  56. package/dist/orbit.d.cts +117 -0
  57. package/dist/orbit.d.ts +117 -0
  58. package/dist/orbit.js +29 -0
  59. package/dist/parser-JPjjFgeP.d.cts +73 -0
  60. package/dist/parser-JPjjFgeP.d.ts +73 -0
  61. package/dist/rinex.cjs +1375 -0
  62. package/dist/rinex.d.cts +116 -0
  63. package/dist/rinex.d.ts +116 -0
  64. package/dist/rinex.js +37 -0
  65. package/dist/rtcm3.cjs +1519 -0
  66. package/dist/rtcm3.d.cts +143 -0
  67. package/dist/rtcm3.d.ts +143 -0
  68. package/dist/rtcm3.js +31 -0
  69. package/dist/signals.cjs +858 -0
  70. package/dist/signals.d.cts +93 -0
  71. package/dist/signals.d.ts +93 -0
  72. package/dist/signals.js +70 -0
  73. package/dist/time-DnI1VpE8.d.cts +33 -0
  74. package/dist/time-DnI1VpE8.d.ts +33 -0
  75. package/dist/time.cjs +585 -0
  76. package/dist/time.d.cts +307 -0
  77. package/dist/time.d.ts +307 -0
  78. package/dist/time.js +154 -0
  79. package/package.json +112 -14
  80. package/.prettierrc +0 -5
  81. package/jest.config.ts +0 -9
  82. package/test/functions.test.ts +0 -63
  83. package/test/gnss-scales.test.ts +0 -95
  84. package/test/julian.test.ts +0 -145
  85. package/test/rinex.test.ts +0 -11
  86. package/test/test.ts +0 -10
  87. package/test/utc.test.ts +0 -25
@@ -0,0 +1,117 @@
1
+ import { E as Ephemeris, G as GlonassEphemeris, K as KeplerEphemeris } from './nav-BAI1a9vK.js';
2
+ import { E as EphemerisInfo } from './ephemeris-BUWzfmBy.js';
3
+ export { e as ecefToGeodetic, g as geodeticToEcef } from './ecef-CF0uAysr.js';
4
+
5
+ /**
6
+ * Satellite orbit computation from broadcast ephemerides.
7
+ * Supports GPS, Galileo, BeiDou (Keplerian) and GLONASS (Runge-Kutta).
8
+ */
9
+
10
+ interface SatPosition {
11
+ prn: string;
12
+ x: number;
13
+ y: number;
14
+ z: number;
15
+ }
16
+ interface SatAzEl {
17
+ prn: string;
18
+ az: number;
19
+ el: number;
20
+ lat: number;
21
+ lon: number;
22
+ cn0?: number;
23
+ }
24
+ interface DopValues {
25
+ gdop: number;
26
+ pdop: number;
27
+ hdop: number;
28
+ vdop: number;
29
+ }
30
+ /**
31
+ * Compute satellite ECEF position from Keplerian ephemeris.
32
+ * @param eph Broadcast ephemeris
33
+ * @param t GPS time of week in seconds
34
+ */
35
+ declare function keplerPosition(eph: KeplerEphemeris, t: number): SatPosition;
36
+ /**
37
+ * Compute GLONASS satellite ECEF position.
38
+ * @param eph GLONASS ephemeris
39
+ * @param tUtc Target time as UTC seconds since Unix epoch
40
+ */
41
+ declare function glonassPosition(eph: GlonassEphemeris, tUtc: number): SatPosition;
42
+ /**
43
+ * Compute azimuth and elevation from receiver ECEF to satellite ECEF.
44
+ * @param rxX Receiver X in meters (ECEF)
45
+ * @param rxY Receiver Y in meters (ECEF)
46
+ * @param rxZ Receiver Z in meters (ECEF)
47
+ * @param satX Satellite X in meters (ECEF)
48
+ * @param satY Satellite Y in meters (ECEF)
49
+ * @param satZ Satellite Z in meters (ECEF)
50
+ * @returns {az: radians, el: radians}
51
+ */
52
+ declare function ecefToAzEl(rxX: number, rxY: number, rxZ: number, satX: number, satY: number, satZ: number): {
53
+ az: number;
54
+ el: number;
55
+ };
56
+ /**
57
+ * Compute DOP values from a set of satellite az/el.
58
+ * @param satAzEls Array of satellite azimuth/elevation pairs (radians)
59
+ * @returns DOP values (GDOP, PDOP, HDOP, VDOP), or null if fewer than 4 satellites
60
+ */
61
+ declare function computeDop(satAzEls: {
62
+ az: number;
63
+ el: number;
64
+ }[]): DopValues | null;
65
+ /**
66
+ * Find the best ephemeris for a given PRN at a given time.
67
+ * Selects the one with the closest epoch (toe/toc) to the target time.
68
+ * @param ephemerides Array of candidate ephemerides
69
+ * @param prn Satellite PRN identifier (e.g. "G01")
70
+ * @param timeMs Target time in Unix milliseconds
71
+ */
72
+ declare function selectEphemeris(ephemerides: Ephemeris[], prn: string, timeMs: number): Ephemeris | null;
73
+ /**
74
+ * Compute satellite position from ephemeris.
75
+ * @param eph Ephemeris record
76
+ * @param timeMs Target time in Unix milliseconds
77
+ * @returns Satellite position with ECEF coordinates in meters
78
+ */
79
+ declare function computeSatPosition(eph: Ephemeris, timeMs: number): SatPosition;
80
+ interface EpochSkyData {
81
+ time: number;
82
+ satellites: SatAzEl[];
83
+ dop: DopValues | null;
84
+ }
85
+ /**
86
+ * Derive evenly-spaced epoch times from an ephemeris set's toc range.
87
+ * @param ephs Array of ephemerides to derive the time span from
88
+ * @returns Array of epoch timestamps in Unix milliseconds
89
+ */
90
+ declare function navTimesFromEph(ephs: Ephemeris[]): number[];
91
+ interface SatPoint {
92
+ lat: number;
93
+ lon: number;
94
+ az: number;
95
+ el: number;
96
+ }
97
+ interface AllPositionsData {
98
+ /** All unique PRNs sorted. */
99
+ prns: string[];
100
+ /** Epoch timestamps in Unix ms. */
101
+ times: number[];
102
+ /** positions[prn][epochIdx] — null if no valid ephemeris. */
103
+ positions: Record<string, (SatPoint | null)[]>;
104
+ }
105
+ /**
106
+ * Compute satellite positions for ALL PRNs at all times in a single pass.
107
+ * Returns geodetic (lat/lon) for ground tracks and az/el for sky plot.
108
+ * When rxPos is provided, az/el are computed; otherwise they are 0.
109
+ */
110
+ declare function computeAllPositions(ephemerides: Ephemeris[], times: number[], rxPos?: [number, number, number]): AllPositionsData;
111
+ /**
112
+ * Compute current satellite az/el from live RTCM3 ephemeris data.
113
+ * Returns array of SatAzEl for all satellites with valid ephemeris.
114
+ */
115
+ declare function computeLiveSkyPositions(ephemerides: Map<string, EphemerisInfo>, rxPos: [number, number, number], cn0Map?: Map<string, number>): SatAzEl[];
116
+
117
+ export { type AllPositionsData, type DopValues, type EpochSkyData, type SatAzEl, type SatPoint, type SatPosition, computeAllPositions, computeDop, computeLiveSkyPositions, computeSatPosition, ecefToAzEl, glonassPosition, keplerPosition, navTimesFromEph, selectEphemeris };
package/dist/orbit.js ADDED
@@ -0,0 +1,29 @@
1
+ import {
2
+ computeAllPositions,
3
+ computeDop,
4
+ computeLiveSkyPositions,
5
+ computeSatPosition,
6
+ ecefToAzEl,
7
+ glonassPosition,
8
+ keplerPosition,
9
+ navTimesFromEph,
10
+ selectEphemeris
11
+ } from "./chunk-SDRRAJT5.js";
12
+ import {
13
+ ecefToGeodetic,
14
+ geodeticToEcef
15
+ } from "./chunk-37QNKGTC.js";
16
+ import "./chunk-6FAL6P4G.js";
17
+ export {
18
+ computeAllPositions,
19
+ computeDop,
20
+ computeLiveSkyPositions,
21
+ computeSatPosition,
22
+ ecefToAzEl,
23
+ ecefToGeodetic,
24
+ geodeticToEcef,
25
+ glonassPosition,
26
+ keplerPosition,
27
+ navTimesFromEph,
28
+ selectEphemeris
29
+ };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Streaming RINEX / CRX observation file parser.
3
+ * Supports RINEX 2.x, 3.x/4.x and Compact RINEX (Hatanaka) 1.0/3.0.
4
+ */
5
+ interface RinexHeader {
6
+ version: number;
7
+ type: string;
8
+ satSystem: string;
9
+ markerName: string;
10
+ markerType: string;
11
+ observer: string;
12
+ agency: string;
13
+ receiverNumber: string;
14
+ receiverType: string;
15
+ receiverVersion: string;
16
+ antNumber: string;
17
+ antType: string;
18
+ approxPosition: [number, number, number] | null;
19
+ antDelta: [number, number, number] | null;
20
+ interval: number | null;
21
+ timeOfFirstObs: Date | null;
22
+ timeOfLastObs: Date | null;
23
+ obsTypes: Record<string, string[]>;
24
+ /** GLONASS frequency channel numbers. Key = slot (1-24), value = channel k (−7…+6). */
25
+ glonassSlots: Record<number, number>;
26
+ isCrx: boolean;
27
+ crxVersion: number;
28
+ }
29
+ interface EpochSummary {
30
+ time: number;
31
+ totalSats: number;
32
+ satsPerSystem: Record<string, number>;
33
+ meanSnr: number | null;
34
+ snrPerSystem: Record<string, number>;
35
+ snrPerSat: Record<string, number>;
36
+ /** Per-satellite per-band SNR. Key = "PRN:band" e.g. "G01:1" → dB-Hz */
37
+ snrPerSatBand?: Record<string, number>;
38
+ }
39
+ interface RinexStats {
40
+ totalEpochs: number;
41
+ validEpochs: number;
42
+ duration: number | null;
43
+ startTime: Date | null;
44
+ endTime: Date | null;
45
+ interval: number | null;
46
+ uniqueSatellites: number;
47
+ uniqueSatsPerSystem: Record<string, number>;
48
+ systems: string[];
49
+ meanSatellites: number;
50
+ meanSnr: number | null;
51
+ }
52
+ interface RinexResult {
53
+ header: RinexHeader;
54
+ epochs: EpochSummary[];
55
+ stats: RinexStats;
56
+ }
57
+ /** Canonical constellation display order: GPS → GLONASS → Galileo → BeiDou → QZSS → NavIC → SBAS */
58
+ declare const SYSTEM_ORDER: readonly ["G", "R", "E", "C", "J", "I", "S"];
59
+ /** Compare two system codes (or PRNs) in canonical constellation order. */
60
+ declare function systemCmp(a: string, b: string): number;
61
+ declare function systemName(code: string): string;
62
+ /** Callback invoked for each satellite observation line with all raw values. */
63
+ type SatObsCallback = (time: number, prn: string, codes: string[], values: (number | null)[]) => void;
64
+ interface ParseOptions {
65
+ onProgress?: (percent: number) => void;
66
+ signal?: AbortSignal;
67
+ onSatObs?: SatObsCallback;
68
+ /** Skip EpochSummary construction and setTimeout yields (for Web Worker). */
69
+ workerMode?: boolean;
70
+ }
71
+ declare function parseRinexStream(file: File, onProgress?: (percent: number) => void, signal?: AbortSignal, onSatObs?: SatObsCallback, workerMode?: boolean): Promise<RinexResult>;
72
+
73
+ export { type EpochSummary as E, type ParseOptions as P, type RinexHeader as R, SYSTEM_ORDER as S, type RinexResult as a, type RinexStats as b, type SatObsCallback as c, systemName as d, parseRinexStream as p, systemCmp as s };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Streaming RINEX / CRX observation file parser.
3
+ * Supports RINEX 2.x, 3.x/4.x and Compact RINEX (Hatanaka) 1.0/3.0.
4
+ */
5
+ interface RinexHeader {
6
+ version: number;
7
+ type: string;
8
+ satSystem: string;
9
+ markerName: string;
10
+ markerType: string;
11
+ observer: string;
12
+ agency: string;
13
+ receiverNumber: string;
14
+ receiverType: string;
15
+ receiverVersion: string;
16
+ antNumber: string;
17
+ antType: string;
18
+ approxPosition: [number, number, number] | null;
19
+ antDelta: [number, number, number] | null;
20
+ interval: number | null;
21
+ timeOfFirstObs: Date | null;
22
+ timeOfLastObs: Date | null;
23
+ obsTypes: Record<string, string[]>;
24
+ /** GLONASS frequency channel numbers. Key = slot (1-24), value = channel k (−7…+6). */
25
+ glonassSlots: Record<number, number>;
26
+ isCrx: boolean;
27
+ crxVersion: number;
28
+ }
29
+ interface EpochSummary {
30
+ time: number;
31
+ totalSats: number;
32
+ satsPerSystem: Record<string, number>;
33
+ meanSnr: number | null;
34
+ snrPerSystem: Record<string, number>;
35
+ snrPerSat: Record<string, number>;
36
+ /** Per-satellite per-band SNR. Key = "PRN:band" e.g. "G01:1" → dB-Hz */
37
+ snrPerSatBand?: Record<string, number>;
38
+ }
39
+ interface RinexStats {
40
+ totalEpochs: number;
41
+ validEpochs: number;
42
+ duration: number | null;
43
+ startTime: Date | null;
44
+ endTime: Date | null;
45
+ interval: number | null;
46
+ uniqueSatellites: number;
47
+ uniqueSatsPerSystem: Record<string, number>;
48
+ systems: string[];
49
+ meanSatellites: number;
50
+ meanSnr: number | null;
51
+ }
52
+ interface RinexResult {
53
+ header: RinexHeader;
54
+ epochs: EpochSummary[];
55
+ stats: RinexStats;
56
+ }
57
+ /** Canonical constellation display order: GPS → GLONASS → Galileo → BeiDou → QZSS → NavIC → SBAS */
58
+ declare const SYSTEM_ORDER: readonly ["G", "R", "E", "C", "J", "I", "S"];
59
+ /** Compare two system codes (or PRNs) in canonical constellation order. */
60
+ declare function systemCmp(a: string, b: string): number;
61
+ declare function systemName(code: string): string;
62
+ /** Callback invoked for each satellite observation line with all raw values. */
63
+ type SatObsCallback = (time: number, prn: string, codes: string[], values: (number | null)[]) => void;
64
+ interface ParseOptions {
65
+ onProgress?: (percent: number) => void;
66
+ signal?: AbortSignal;
67
+ onSatObs?: SatObsCallback;
68
+ /** Skip EpochSummary construction and setTimeout yields (for Web Worker). */
69
+ workerMode?: boolean;
70
+ }
71
+ declare function parseRinexStream(file: File, onProgress?: (percent: number) => void, signal?: AbortSignal, onSatObs?: SatObsCallback, workerMode?: boolean): Promise<RinexResult>;
72
+
73
+ export { type EpochSummary as E, type ParseOptions as P, type RinexHeader as R, SYSTEM_ORDER as S, type RinexResult as a, type RinexStats as b, type SatObsCallback as c, systemName as d, parseRinexStream as p, systemCmp as s };