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
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2024-2026 Miguel González <work@miguel.es>
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU Affero General Public License as published
8
+ by the Free Software Foundation, version 3 of the License.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Affero General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Affero General Public License
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ ---
19
+
20
+ COMMERCIAL LICENSE
21
+
22
+ For use in proprietary or closed-source software, a separate commercial
23
+ license is available. Contact work@miguel.es for terms.
package/README.md CHANGED
@@ -1,9 +1,175 @@
1
- # GNSS.js
1
+ # gnss-js
2
2
 
3
- GNSS.js is a library for all JavaScript environments (browser, Node.js, etc.) to perform several types of GNSS-related computations.
3
+ Comprehensive GNSS library for JavaScript and TypeScript. Zero dependencies. Works in Node.js, browsers, Deno, Bun, and Workers.
4
4
 
5
- The name GNSS.js is dervived from the acronym GNSS (Global Navigation Satellite System) and JS (JavaScript).
5
+ ## Install
6
6
 
7
- There are multiple conversion functions between different time and coordinate systems, such as `getRINEX`, `getDateFromRINEX`, etc.
7
+ ```bash
8
+ npm install gnss-js
9
+ ```
8
10
 
9
- Further documentation will follow in the future.
11
+ ## Modules
12
+
13
+ Import only what you need via subpath exports:
14
+
15
+ ### Time scales
16
+
17
+ ```ts
18
+ import {
19
+ getGpsTime,
20
+ getTimeOfWeek,
21
+ getWeekNumber,
22
+ getDateFromGpsData,
23
+ } from 'gnss-js/time';
24
+ import { getGalTime, getBdsTime, getUnixTime } from 'gnss-js/time';
25
+ import { getJulianDate, getMJD } from 'gnss-js/time';
26
+ import { getLeap, getGpsLeap, getUtcDate } from 'gnss-js/time';
27
+
28
+ const date = new Date('2024-01-15T12:00:00Z');
29
+ const gpsTime = getGpsTime(date); // milliseconds since GPS epoch
30
+ const tow = getTimeOfWeek(date); // milliseconds into current GPS week
31
+ const week = getWeekNumber(date); // GPS week number
32
+ ```
33
+
34
+ ### Coordinates
35
+
36
+ ```ts
37
+ import {
38
+ geodeticToEcef,
39
+ ecefToGeodetic,
40
+ vincenty,
41
+ deg2rad,
42
+ } from 'gnss-js/coordinates';
43
+
44
+ const [x, y, z] = geodeticToEcef(deg2rad(48.8566), deg2rad(2.3522), 35);
45
+ const { distance } = vincenty(
46
+ deg2rad(51.5),
47
+ deg2rad(-0.1),
48
+ deg2rad(48.9),
49
+ deg2rad(2.4)
50
+ );
51
+ // distance in meters, angles in radians
52
+ ```
53
+
54
+ ### RINEX parsing
55
+
56
+ ```ts
57
+ import { parseRinexStream, parseNavFile } from 'gnss-js/rinex';
58
+
59
+ // Streaming observation parser (works with ReadableStream)
60
+ const result = await parseRinexStream(stream, {
61
+ onObservation: (time, prn, codes, values) => {
62
+ // process each epoch
63
+ },
64
+ });
65
+
66
+ // Navigation file parser
67
+ const nav = parseNavFile(navFileText);
68
+ // nav.ephemerides: KeplerEphemeris[] | GlonassEphemeris[]
69
+ ```
70
+
71
+ ### RTCM3 decoding
72
+
73
+ ```ts
74
+ import { Rtcm3Decoder, decodeMsmFull, decodeEphemeris } from 'gnss-js/rtcm3';
75
+
76
+ const decoder = new Rtcm3Decoder();
77
+ decoder.addData(chunk); // Uint8Array from NTRIP stream
78
+ for (const frame of decoder) {
79
+ const msm = decodeMsmFull(frame); // MSM4-7 observations
80
+ const eph = decodeEphemeris(frame); // broadcast ephemeris
81
+ }
82
+ ```
83
+
84
+ ### Orbit computation
85
+
86
+ ```ts
87
+ import { computeAllPositions, computeDop } from 'gnss-js/orbit';
88
+
89
+ const positions = computeAllPositions(ephemerides, times, receiverPosition);
90
+ // positions.prns: string[], positions.times: number[], positions.az/el/lat/lon: Float64Array
91
+ ```
92
+
93
+ ### Signal analysis
94
+
95
+ ```ts
96
+ import {
97
+ MultipathAccumulator,
98
+ CycleSlipAccumulator,
99
+ CompletenessAccumulator,
100
+ } from 'gnss-js/analysis';
101
+
102
+ const mp = new MultipathAccumulator(header);
103
+ const cs = new CycleSlipAccumulator(header);
104
+ await parseRinexStream(stream, {
105
+ onObservation: (time, prn, codes, values) => {
106
+ mp.onObservation(time, prn, codes, values);
107
+ cs.onObservation(time, prn, codes, values);
108
+ },
109
+ });
110
+ const multipathResult = mp.finalize();
111
+ const cycleSlipResult = cs.finalize();
112
+ ```
113
+
114
+ ### NTRIP client
115
+
116
+ ```ts
117
+ import { fetchSourcetable, connectToMountpoint } from 'gnss-js/ntrip';
118
+
119
+ const table = await fetchSourcetable('https://proxy.example.com', {
120
+ host: 'caster.example.com',
121
+ port: 2101,
122
+ version: '2.0',
123
+ });
124
+
125
+ const { reader, abort } = await connectToMountpoint(
126
+ 'https://proxy.example.com',
127
+ {
128
+ host: 'caster.example.com',
129
+ port: 2101,
130
+ mountpoint: 'MOUNT',
131
+ username: 'user',
132
+ password: 'pass',
133
+ version: '2.0',
134
+ }
135
+ );
136
+ ```
137
+
138
+ ### Constants
139
+
140
+ ```ts
141
+ import {
142
+ C_LIGHT,
143
+ FREQ,
144
+ SYSTEM_NAMES,
145
+ DUAL_FREQ_PAIRS,
146
+ } from 'gnss-js/constants';
147
+
148
+ FREQ['G']['1']; // 1575.42e6 Hz (GPS L1)
149
+ SYSTEM_NAMES['E']; // "Galileo"
150
+ ```
151
+
152
+ ## Unit conventions
153
+
154
+ All functions use consistent units:
155
+
156
+ | Quantity | Unit |
157
+ | ----------- | ---------------- |
158
+ | Time values | **milliseconds** |
159
+ | Angles | **radians** |
160
+ | Distances | **meters** |
161
+ | Frequencies | **Hz** |
162
+
163
+ Every exported function has JSDoc with `@param` and `@returns` annotations including explicit units.
164
+
165
+ ## Roadmap
166
+
167
+ - **Class-based API** — Ergonomic wrappers like `GnssTime.fromUtc(date).gps` and `Position.fromGeodetic(lat, lon, h).utm` on top of the existing functional core
168
+ - **RINEX observation writers** (RINEX 2/3/4 with gzip compression)
169
+
170
+ ## License
171
+
172
+ This project is dual-licensed:
173
+
174
+ - **AGPL-3.0** — Free for open-source projects. Any software that uses gnss-js must also be open-sourced under a compatible license.
175
+ - **Commercial license** — For proprietary/closed-source use. Contact [work@miguel.es](mailto:work@miguel.es) for terms.