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.
- package/LICENSE +23 -0
- package/README.md +171 -5
- package/dist/analysis.cjs +1381 -0
- package/dist/analysis.d.cts +211 -0
- package/dist/analysis.d.ts +211 -0
- package/dist/analysis.js +14 -0
- package/dist/antex.cjs +239 -0
- package/dist/antex.d.cts +77 -0
- package/dist/antex.d.ts +77 -0
- package/dist/antex.js +8 -0
- package/dist/chunk-354IRDOG.js +239 -0
- package/dist/chunk-37QNKGTC.js +65 -0
- package/dist/chunk-5CMSYIYM.js +214 -0
- package/dist/chunk-5S5MONFK.js +0 -0
- package/dist/chunk-6FAL6P4G.js +12 -0
- package/dist/chunk-7NOFXKET.js +433 -0
- package/dist/chunk-CB6EOOLA.js +753 -0
- package/dist/chunk-HKN3PUGN.js +800 -0
- package/dist/chunk-IS4UUDBV.js +577 -0
- package/dist/chunk-K7WZQFBV.js +236 -0
- package/dist/chunk-LEEU5OIO.js +75 -0
- package/dist/chunk-PRSZIWKM.js +1482 -0
- package/dist/chunk-SDRRAJT5.js +433 -0
- package/dist/chunk-WR7LCB52.js +143 -0
- package/dist/chunk-Y3R57B5P.js +473 -0
- package/dist/chunk-YDMYO3YK.js +220 -0
- package/dist/constants.cjs +394 -0
- package/dist/constants.d.cts +14 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +103 -0
- package/dist/coordinates.cjs +334 -0
- package/dist/coordinates.d.cts +81 -0
- package/dist/coordinates.d.ts +81 -0
- package/dist/coordinates.js +39 -0
- package/dist/ecef-CF0uAysr.d.cts +40 -0
- package/dist/ecef-CF0uAysr.d.ts +40 -0
- package/dist/ephemeris-BUWzfmBy.d.cts +114 -0
- package/dist/ephemeris-BUWzfmBy.d.ts +114 -0
- package/dist/gnss-BT6ulR17.d.cts +56 -0
- package/dist/gnss-C-tgoYNa.d.ts +56 -0
- package/dist/index.cjs +5774 -78
- package/dist/index.d.cts +17 -96
- package/dist/index.d.ts +17 -96
- package/dist/index.js +352 -415
- package/dist/nav-BAI1a9vK.d.cts +108 -0
- package/dist/nav-BAI1a9vK.d.ts +108 -0
- package/dist/nmea.cjs +247 -0
- package/dist/nmea.d.cts +37 -0
- package/dist/nmea.d.ts +37 -0
- package/dist/nmea.js +12 -0
- package/dist/ntrip.cjs +169 -0
- package/dist/ntrip.d.cts +98 -0
- package/dist/ntrip.d.ts +98 -0
- package/dist/ntrip.js +10 -0
- package/dist/orbit.cjs +504 -0
- package/dist/orbit.d.cts +117 -0
- package/dist/orbit.d.ts +117 -0
- package/dist/orbit.js +29 -0
- package/dist/parser-JPjjFgeP.d.cts +73 -0
- package/dist/parser-JPjjFgeP.d.ts +73 -0
- package/dist/rinex.cjs +1375 -0
- package/dist/rinex.d.cts +116 -0
- package/dist/rinex.d.ts +116 -0
- package/dist/rinex.js +37 -0
- package/dist/rtcm3.cjs +1519 -0
- package/dist/rtcm3.d.cts +143 -0
- package/dist/rtcm3.d.ts +143 -0
- package/dist/rtcm3.js +31 -0
- package/dist/signals.cjs +858 -0
- package/dist/signals.d.cts +93 -0
- package/dist/signals.d.ts +93 -0
- package/dist/signals.js +70 -0
- package/dist/time-DnI1VpE8.d.cts +33 -0
- package/dist/time-DnI1VpE8.d.ts +33 -0
- package/dist/time.cjs +585 -0
- package/dist/time.d.cts +307 -0
- package/dist/time.d.ts +307 -0
- package/dist/time.js +154 -0
- package/package.json +112 -14
- package/.prettierrc +0 -5
- package/jest.config.ts +0 -9
- package/test/functions.test.ts +0 -63
- package/test/gnss-scales.test.ts +0 -95
- package/test/julian.test.ts +0 -145
- package/test/rinex.test.ts +0 -11
- package/test/test.ts +0 -10
- 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
|
-
#
|
|
1
|
+
# gnss-js
|
|
2
2
|
|
|
3
|
-
GNSS
|
|
3
|
+
Comprehensive GNSS library for JavaScript and TypeScript. Zero dependencies. Works in Node.js, browsers, Deno, Bun, and Workers.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install gnss-js
|
|
9
|
+
```
|
|
8
10
|
|
|
9
|
-
|
|
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.
|