@johnmorrisdotca/chikyu-earth 0.36.0 → 0.37.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/CHANGELOG.md +8 -0
- package/NOTICE.md +4 -0
- package/README.md +1 -1
- package/dist/catalogue/index.d.ts +1 -0
- package/dist/catalogue/index.js +3 -2
- package/dist/catalogue/pack.js +3 -0
- package/dist/cities/host.js +38 -8
- package/dist/realistic/earth.js +1 -1
- package/dist/realistic/element.d.ts +10 -2
- package/dist/realistic/element.js +24 -8
- package/dist/realistic/textures.d.ts +2 -0
- package/dist/satellites/index.d.ts +1 -0
- package/dist/satellites/index.js +1 -0
- package/dist/satellites/limits.d.ts +1 -1
- package/dist/satellites/limits.js +1 -1
- package/dist/satellites/owners.d.ts +26 -0
- package/dist/satellites/owners.js +164 -0
- package/dist/satellites/source.js +3 -0
- package/dist/satellites/track.d.ts +5 -0
- package/dist/satellites/track.js +128 -0
- package/dist/satellites/types.d.ts +19 -1
- package/dist/space/element.d.ts +30 -5
- package/dist/space/element.js +115 -11
- package/dist/space/index.d.ts +1 -1
- package/dist/space/index.js +1 -1
- package/dist/space/ride.d.ts +42 -0
- package/dist/space/ride.js +45 -3
- package/dist/space/satellite-layer.d.ts +8 -2
- package/dist/space/satellite-layer.js +138 -19
- package/dist/space/scene.d.ts +3 -1
- package/dist/space/scene.js +9 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.37.0 - 2026-11-12
|
|
6
|
+
|
|
7
|
+
- **A satellite's owner country as an ISO code** (MODULES-1112), for a page that puts a flag on a satellite card. `satelliteInfo` and the click event's `info` have `ownerCountry`, an ISO 3166-1 alpha-2 code (`CN`, `US`, `PK`), when the elements carry an owner code (`COUNTRY_CODE` or `OWNER`) and the owner is one country. An organisation (`ESA`, `ISS`, `ITSO`, `SES`, `GLOB`, `EUME`, `NATO`, `AB` and the like), several countries, an unknown owner, or a code the list does not give to one country (`CIS`, the former Soviet registration) has none, and the field is left off. New in `@johnmorrisdotca/chikyu-earth/satellites` and `/catalogue`: `ownerCountry(code)` and `OWNER_COUNTRIES`, every code of the catalogue's owner list, each row checked. Data only: no flag, no new dependency.
|
|
8
|
+
- **City names can be taken off and put back, and a font is measured once** (MODULES-1097). Removing `<chikyu-space>` or `<chikyu-earth-realistic>` while a tier of city names is still loading no longer leaves a second canvas and a second names box when it is put back: a load that arrives after the layer is gone does nothing, and neither does its error. The font used to measure the names is read again only when the style, the size or the language changes, not on every draw. A font that finishes loading after the space view has measured its body-name boxes is measured again.
|
|
9
|
+
- **Satellites stay on the picture when the clock runs faster than a minute a second** (MODULES-860). Above 60 times real time they were hidden, because two SGP4 samples would be too far apart to interpolate. Each satellite is now a short streak along its orbit for the stretch one frame spans: one SGP4 sample about once a second, then turned by its mean motion, on `<chikyu-space>` and `<chikyu-earth-realistic>`. `satellite-tint="orbit"` (off by default) colours them by orbit class. Dots grow as the Earth is drawn larger and shrink as it is drawn smaller, and a dark rim keeps a pale dot readable on the bright ground. `stats.satellites.placed` is how many are drawn, `segments` how many streaks, and `epochMs` the newest element set's moment. New on `Satellites`: `pin`, `arc`, `classColour` and `newestEpochMs`; `tooFast` stays true above 60 times, so a page that read it as "hidden" should read `placed` or `segments` instead. **A page that hands over its own three.js parts (`setThreeLoader`) should add `LineSegments`** for the streaks (the demo's `three-subset.ts` has it); without it the satellites above 60 times are dots alone, with one console warning, and nothing else changes. An orbit with an eccentricity of 0.02 or more (a Molniya, a transfer orbit) is placed by SGP4 itself on every frame there, because turning it at the mean motion put it kilometres off its path.
|
|
10
|
+
- **Face a way again while riding** (MODULES-1105). `face("ahead" | "behind" | "left" | "right" | "down" | "up")` turns the camera there in half a second (at once when the reader asked for less motion) and keeps the zoom. Ahead is along the way it goes, behind is the opposite, left and right are across that way, down is straight at the Earth and up is straight away from it. In the above view, down looks straight down at the satellite. `facing` is that way until the view is turned or tipped, and `chikyu-ride-face` is sent when it changes. Keys, while the element is focused: W, S, A, D, R and F. The arrow keys stay with the view controls. The demo has a Face row and the address keeps `face`.
|
|
11
|
+
- **Facing, made safe** (MODULES-1105 review): following a planet or the Moon there is no way to face, so `face()` answers `false` and nothing is told; a held key's repeats do not start the glide again; a key typed in a field inside the element, or in editable text, is left to it.
|
|
12
|
+
|
|
5
13
|
## 0.36.0 - 2026-11-12
|
|
6
14
|
|
|
7
15
|
- **kazoku-ui 0.41.0, a dependency of this package** (`^0.38.1` to `^0.41.0`, for MacBook browser runs in CI's own Playwright image): a page that installs chikyu-earth now gets kazoku-ui 0.41. What it changes for this package's elements: in Safari a trackpad pinch over a view zooms the view and no longer the whole page (kazoku-ui 0.40.2); `<kazoku-view-controls>` writes a pace, direction or axis read from the address back to its attributes (0.40.0, 0.40.1), which matters only to a page that reads them. The elements' own attributes, events and defaults are unchanged.
|
package/NOTICE.md
CHANGED
|
@@ -93,6 +93,10 @@ terms: a snapshot with credit, never a live fetch. The catalogue (`src/satellite
|
|
|
93
93
|
|
|
94
94
|
The same build may take a group's element sets from **Space-Track.org** (https://www.space-track.org, U.S. Space Command) when CelesTrak has left the group more than 12 hours old, at most once a day, through its API with John Morris's own account (the login is a repository secret, never in a file). The group's file and `manifest.json` say `"source": "spacetrack"` and the demo says so under the globe. The citation is **"Data from Space-Track.org (USSPACECOM)"**. Terms: the documentation page https://www.space-track.org/documentation, section "Redistribution of Basic SSA Information", read 2026-11-08: "USSPACECOM has provided express blanket approval for transfer/redistribution of basic SSA data and services accessed via www.Space-Track.org conditioned on appropriate citation." Basic SSA data are "Two-Line Elements (TLEs) and Orbital Mean-element Messages (OMMs); SATCAT; and Satellite Decay and Reentry Data." (The page needs a browser; the section was read through a page-reading tool, which returned each sentence in quoted pieces. TODO: John or a browser check of the section's wording.) The page gives no citation form, so this sentence is the package's own. The package ships none of these element sets.
|
|
95
95
|
|
|
96
|
+
## Satellite owners' countries
|
|
97
|
+
|
|
98
|
+
`src/satellites/owners.ts` gives each owner code of the satellite catalogue the country it stands for, as an ISO 3166-1 alpha-2 code, or none for an organisation, several countries, an unknown owner, or a code the list does not give to one country. The codes and what each stands for were typed from CelesTrak's list of SATCAT sources (https://celestrak.org/satcat/sources.php, T.S. Kelso, read 2026-11-12, 132 codes); a code and the name of a country are facts. The two-letter codes are ISO 3166-1's, also facts. `CIS` is left unset: the list calls it "Commonwealth of Independent States (former USSR)" and does not name Russia. `ISRO` is India, that country's space agency. No flag is drawn or shipped.
|
|
99
|
+
|
|
96
100
|
## Meteor showers
|
|
97
101
|
|
|
98
102
|
`src/data/meteor-showers.ts` (in the package, the `./meteors` entry point) is the **International Meteor Organization**'s Working List of Visual Meteor Showers: Table 5 of the *2026 Meteor Shower Calendar*, edited by Jürgen Rendtel (IMO INFO(3-25), https://www.imo.net/files/meteor-shower/cal2026.pdf, read 2026-11-10), typed by hand: each shower's code and number, dates of activity, date and solar longitude of the maximum, radiant, speed, population index and zenithal hourly rate. The table says its details "were correct according to the best information available in June 2025, with maximum dates accurate only for 2026". The Antihelion Source is left out. The Calendar states no licence or reuse terms; these are facts from a published list, credited here and in the guide, and will be removed on request. On 2026-11-11 every row was checked against the **IAU Meteor Data Center** (https://www.ta3.sk/IAUC22DB/MDC2022/, kept by the Astronomical Institute of the Slovak Academy of Sciences under Division F of the International Astronomical Union): its list of all showers and its list of established showers (`streamfulldata2026.txt` and `streamestablisheddata2026.txt`, last update 2026-11-10 20:00 UTC, read 2026-11-11). **The MDC states no licence or reuse terms**, on its pages or in its data files; the files ask, in their headers, that the shower database be cited as Jenniskens, Jopek, Janches, Hajdukova, Kokhirova and Rudawska (2020), *Planetary and Space Science* 182, 104821, and Jopek and Kanuchova (2017), *Planetary and Space Science* 143, 3-6, which is done here, in `IAU_MDC` and in the guide. What is taken is facts from a published list, credited and removed on request: each shower's IAU name, number and status, its parent body from the MDC's origin column (the 26 showers whose solutions name one; the delta-Aquariids' name two different bodies and are given none), and the check of the table's radiants and speeds against the MDC's solutions (rule and result in `src/data/meteor-iau.ts`; three rows took the MDC's figures: the April Lyrids' and alpha-Monocerotids' speeds and the eta-Eridanids' radiant). The MDC lists no maximum date and no zenithal hourly rate, so the dates and rates stay the IMO's. `test/recorded/iau-mdc-showers-2026-11-11.json` holds the MDC's solutions of the 37 showers as read, for the tests. The parent bodies agree with the ones the Calendar's own text names (Lyrids, June Bootids, Perseids, Draconids, Taurids, Leonids) and with **NASA**'s pages on the shower (Quadrantids, eta Aquariids, Orionids, Geminids; https://science.nasa.gov/solar-system/meteors-meteorites/, read 2026-11-10); the other 15 are the MDC's alone. The Japanese names are the names in use in Japan. The heights between which meteors shine (80 to 120 km) and the range of their speeds are as the American Meteor Society's FAQ gives them (https://www.amsmeteors.org/faq/, read 2026-11-10), as figures only; none of its text is copied.
|
package/README.md
CHANGED
|
@@ -608,7 +608,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
608
608
|
|
|
609
609
|
## How to cite
|
|
610
610
|
|
|
611
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.
|
|
611
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.37.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
612
612
|
|
|
613
613
|
GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
|
|
614
614
|
|
|
@@ -3,3 +3,4 @@ export { CLASS_LIMITS, GEO_ALTITUDE_KM, classOfElements, orbitClass, orbitShape,
|
|
|
3
3
|
export { FLEETS, countFleets, fleetOf, type Fleet } from "./fleets.ts";
|
|
4
4
|
export { MAX_PACKED, MAX_PACKED_BYTES, PackError, gzipBytes, packCatalogue, unpackAny, unpackCatalogue, type CatalogueRecord, type PackedCatalogue, type RadarSize } from "./pack.ts";
|
|
5
5
|
export { readCatalogueRecords, type CatalogueRead } from "./omm.ts";
|
|
6
|
+
export { OWNER_COUNTRIES, ownerCountry } from "../satellites/owners.ts";
|
package/dist/catalogue/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
// The Earth-orbit catalogue's pure parts (`@johnmorrisdotca/chikyu-earth/catalogue`): the class of an orbit from its elements, the kind of an object, a colour and a legend for each, the fleets,
|
|
2
|
-
// writes and a page reads (up to 200,000 records, six-digit catalogue numbers held). No
|
|
1
|
+
// The Earth-orbit catalogue's pure parts (`@johnmorrisdotca/chikyu-earth/catalogue`): the class of an orbit from its elements, the kind of an object, a colour and a legend for each, the fleets, the packed file a refresh script
|
|
2
|
+
// writes and a page reads (up to 200,000 records, six-digit catalogue numbers held), and the country of each owner code. No elements are here: they come from a source you choose, through the data door (`packedElementsFrom`). No DOM, no dependency.
|
|
3
3
|
export { OBJECT_KINDS, KIND_LABELS, KIND_COLOURS, CLASS_COLOURS, CLASS_LABELS, ORBIT_CLASSES, legend, readKind } from "./kinds.js";
|
|
4
4
|
export { CLASS_LIMITS, GEO_ALTITUDE_KM, classOfElements, orbitClass, orbitShape } from "./orbit.js";
|
|
5
5
|
export { FLEETS, countFleets, fleetOf } from "./fleets.js";
|
|
6
6
|
export { MAX_PACKED, MAX_PACKED_BYTES, PackError, gzipBytes, packCatalogue, unpackAny, unpackCatalogue } from "./pack.js";
|
|
7
7
|
export { readCatalogueRecords } from "./omm.js";
|
|
8
|
+
export { OWNER_COUNTRIES, ownerCountry } from "../satellites/owners.js";
|
package/dist/catalogue/pack.js
CHANGED
package/dist/cities/host.js
CHANGED
|
@@ -43,10 +43,12 @@ export function createCityHost(options) {
|
|
|
43
43
|
const pool = [];
|
|
44
44
|
let max = readCityNames(options.attribute("city-names"));
|
|
45
45
|
let drawnBefore = false;
|
|
46
|
+
/** Set in `dispose`: a tier that arrives later, or a font or language event already queued, must not attach again. */
|
|
47
|
+
let gone = false;
|
|
46
48
|
/** The language the names were last laid out in: the page may change its language after the element was made, so it is read again at each draw. */
|
|
47
49
|
let usedLang;
|
|
48
50
|
const attach = () => {
|
|
49
|
-
if (canvas)
|
|
51
|
+
if (gone || canvas)
|
|
50
52
|
return;
|
|
51
53
|
canvas = doc.createElement("canvas");
|
|
52
54
|
canvas.id = "cn-canvas";
|
|
@@ -82,18 +84,26 @@ export function createCityHost(options) {
|
|
|
82
84
|
set("--chikyu-city-halo", style.halo);
|
|
83
85
|
set("--chikyu-city-halo-width", style.haloWidth);
|
|
84
86
|
}
|
|
85
|
-
/** The width of a name in the font it is drawn in: a canvas set to the layer's own font, size and weight (the page's `--chikyu-city-*` properties, or the style set), so a fallback font with wider letters is measured as it is. */
|
|
87
|
+
/** The width of a name in the font it is drawn in: a canvas set to the layer's own font, size and weight (the page's `--chikyu-city-*` properties, or the style set), so a fallback font with wider letters is measured as it is. The font string is read again only when the style, the size or the language changes, not on every draw. */
|
|
86
88
|
let ruler;
|
|
89
|
+
let fontKey = "";
|
|
90
|
+
let fontValue = "";
|
|
87
91
|
const measurer = (size) => {
|
|
88
92
|
if (ruler === undefined)
|
|
89
93
|
ruler = doc.createElement("canvas").getContext?.("2d") ?? null;
|
|
90
94
|
const context = ruler;
|
|
91
95
|
if (!context || typeof context.measureText !== "function")
|
|
92
96
|
return undefined;
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
const lang = options.language();
|
|
98
|
+
const key = `${style.font ?? ""}\0${style.weight ?? ""}\0${size}\0${lang}`;
|
|
99
|
+
if (key !== fontKey) {
|
|
100
|
+
fontKey = key;
|
|
101
|
+
const host = root.host ? getComputedStyle(root.host) : undefined;
|
|
102
|
+
const family = style.font ?? (host?.getPropertyValue("--chikyu-city-font").trim() || "system-ui, -apple-system, 'Segoe UI', sans-serif");
|
|
103
|
+
const weight = style.weight ?? (host?.getPropertyValue("--chikyu-city-weight").trim() || 500);
|
|
104
|
+
fontValue = `${weight} ${size}px ${family}`;
|
|
105
|
+
}
|
|
106
|
+
context.font = fontValue;
|
|
97
107
|
return (text) => context.measureText(text).width;
|
|
98
108
|
};
|
|
99
109
|
/** The cities of the tiers wanted that have arrived, the highest rank first; made again only when the tiers or the lists change. */
|
|
@@ -114,15 +124,23 @@ export function createCityHost(options) {
|
|
|
114
124
|
asked.add(tier);
|
|
115
125
|
void load(tier)
|
|
116
126
|
.then((cities) => {
|
|
127
|
+
if (gone)
|
|
128
|
+
return;
|
|
117
129
|
lists.set(tier, cities);
|
|
118
130
|
version += 1;
|
|
119
131
|
compute();
|
|
120
132
|
options.onLayout?.();
|
|
121
133
|
})
|
|
122
|
-
.catch((error) =>
|
|
134
|
+
.catch((error) => {
|
|
135
|
+
if (gone)
|
|
136
|
+
return;
|
|
137
|
+
options.onError(error);
|
|
138
|
+
});
|
|
123
139
|
}
|
|
124
140
|
};
|
|
125
141
|
function compute() {
|
|
142
|
+
if (gone)
|
|
143
|
+
return;
|
|
126
144
|
const frame = last;
|
|
127
145
|
if (max === null || !frame)
|
|
128
146
|
return;
|
|
@@ -187,6 +205,8 @@ export function createCityHost(options) {
|
|
|
187
205
|
}
|
|
188
206
|
// the family's chooser tells the document when the page's language changes: the names are written again, though nothing else is drawn
|
|
189
207
|
const onLanguage = () => queueMicrotask(() => {
|
|
208
|
+
if (gone)
|
|
209
|
+
return;
|
|
190
210
|
if (max !== null && last && usedLang !== undefined && usedLang !== options.language()) {
|
|
191
211
|
compute();
|
|
192
212
|
options.onLayout?.();
|
|
@@ -195,7 +215,8 @@ export function createCityHost(options) {
|
|
|
195
215
|
doc.addEventListener("kazoku-languagechange", onLanguage);
|
|
196
216
|
// a font arrives: the names are measured in the font they are drawn in, so they are laid out again
|
|
197
217
|
const onFonts = () => {
|
|
198
|
-
|
|
218
|
+
fontKey = "";
|
|
219
|
+
if (!gone && max !== null && last) {
|
|
199
220
|
compute();
|
|
200
221
|
options.onLayout?.();
|
|
201
222
|
}
|
|
@@ -203,6 +224,8 @@ export function createCityHost(options) {
|
|
|
203
224
|
doc.fonts?.addEventListener?.("loadingdone", onFonts);
|
|
204
225
|
return {
|
|
205
226
|
frame(next) {
|
|
227
|
+
if (gone)
|
|
228
|
+
return;
|
|
206
229
|
last = next;
|
|
207
230
|
if (max === null)
|
|
208
231
|
return;
|
|
@@ -213,6 +236,8 @@ export function createCityHost(options) {
|
|
|
213
236
|
compute();
|
|
214
237
|
},
|
|
215
238
|
refresh() {
|
|
239
|
+
if (gone)
|
|
240
|
+
return;
|
|
216
241
|
max = readCityNames(options.attribute("city-names"));
|
|
217
242
|
if (max === null) {
|
|
218
243
|
clear();
|
|
@@ -221,6 +246,8 @@ export function createCityHost(options) {
|
|
|
221
246
|
compute();
|
|
222
247
|
},
|
|
223
248
|
setStyle(next) {
|
|
249
|
+
if (gone)
|
|
250
|
+
return;
|
|
224
251
|
style = { ...next };
|
|
225
252
|
vars();
|
|
226
253
|
compute();
|
|
@@ -236,6 +263,9 @@ export function createCityHost(options) {
|
|
|
236
263
|
return { on: max !== null, max: max ?? 0, radius: last?.radius ?? 0, tiers: [...lists.keys()], cities: [...lists.values()].reduce((sum, list) => sum + list.length, 0), names: shown.length, renders };
|
|
237
264
|
},
|
|
238
265
|
dispose() {
|
|
266
|
+
gone = true;
|
|
267
|
+
last = null;
|
|
268
|
+
max = null;
|
|
239
269
|
doc.removeEventListener("kazoku-languagechange", onLanguage);
|
|
240
270
|
doc.fonts?.removeEventListener?.("loadingdone", onFonts);
|
|
241
271
|
canvas?.remove();
|
package/dist/realistic/earth.js
CHANGED
|
@@ -234,7 +234,7 @@ export function createEarthItem(model, deps) {
|
|
|
234
234
|
deps.onSatellitesError?.(error);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
layer?.update(model.time, model.speed);
|
|
237
|
+
layer?.update(model.time, model.speed, radius);
|
|
238
238
|
model.pick = layer ? (x, y, radius) => layer.pick(x, y, camera, size, radius) : null;
|
|
239
239
|
model.drawn = { view: { ...view }, time: model.time, radius, centre: { ...centre } };
|
|
240
240
|
textures.sync(radius * model.ratio());
|
|
@@ -35,7 +35,10 @@ export type EarthState = "loading" | "live" | "unavailable" | "lost" | "idle";
|
|
|
35
35
|
type SatelliteStats = {
|
|
36
36
|
groups: number;
|
|
37
37
|
placed: number;
|
|
38
|
+
segments: number;
|
|
38
39
|
tooFast: boolean;
|
|
40
|
+
dotScale: number;
|
|
41
|
+
epochMs: number;
|
|
39
42
|
propagations: number;
|
|
40
43
|
lastBatchMs: number;
|
|
41
44
|
maxBatchMs: number;
|
|
@@ -364,10 +367,15 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
364
367
|
* and draws are at most 30 a second.
|
|
365
368
|
*/
|
|
366
369
|
setView(view: GlobeView, final?: boolean): void;
|
|
370
|
+
/**
|
|
371
|
+
* Colour each satellite by its orbit class (low, medium, geostationary, highly elliptical, other). Off by default, so a group keeps the colour it was given. The attribute is `satellite-tint="orbit"`.
|
|
372
|
+
*/
|
|
373
|
+
get satelliteTint(): "off" | "orbit";
|
|
374
|
+
set satelliteTint(value: "off" | "orbit");
|
|
367
375
|
/**
|
|
368
376
|
* Show a group of satellites (made by `createSatellites`) under a name, or take the group away with `null`. A group is one draw call however many satellites it holds, so every group of the catalogue can be shown at once. Giving the name of a group
|
|
369
377
|
* that is already shown replaces it. `style`: `color` and `size` (CSS pixels) of the dots, and `orbits` to draw every orbit (only for a group of 40 or fewer, such as the stations). The groups are placed by SGP4 about once a second and interpolated
|
|
370
|
-
* between
|
|
378
|
+
* between. Above `MAX_SATELLITE_SPEED` each satellite is a short streak along its orbit instead of being hidden. They are hidden by the Earth when they are behind it, and draw at most 30 times a second and not at all while the clock holds.
|
|
371
379
|
*
|
|
372
380
|
* @param group - The group's name, for `showSatellites`, `selectSatellite` and the events.
|
|
373
381
|
* @param satellites - The group, or `null` to remove it.
|
|
@@ -386,7 +394,7 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
386
394
|
selectSatellite(ref: SatelliteRef | null): void;
|
|
387
395
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
388
396
|
get selectedSatellite(): SatelliteRef | null;
|
|
389
|
-
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period); undefined if it cannot be placed then. */
|
|
397
|
+
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period, and `ownerCountry` when the owner is one country); undefined if it cannot be placed then. */
|
|
390
398
|
satelliteInfo(ref: SatelliteRef): SatelliteInfo | undefined;
|
|
391
399
|
/** The view as it is (for a page that wants to read it back). */
|
|
392
400
|
get view(): GlobeView;
|
|
@@ -7,7 +7,6 @@ import { airFor, readAirThickness } from "./air.js";
|
|
|
7
7
|
import { IMMERSIVE_STYLE, immersiveWheel } from "./immersive.js";
|
|
8
8
|
import { NOTES_STYLE, setAirNote } from "./air-note.js";
|
|
9
9
|
import { cameraCentre, createEarthItem, discRadius, lookAt, newModel } from "./earth.js";
|
|
10
|
-
import { MAX_SATELLITE_SPEED } from "../satellites/limits.js";
|
|
11
10
|
import { MAX_ORBIT_GROUP } from "../space/satellite-layer.js";
|
|
12
11
|
import { readMeteorStrength } from "../meteors/strength.js";
|
|
13
12
|
import { METEOR_NOTE_STYLE, prefersLessMotion, setMeteorNote } from "../meteors/note.js";
|
|
@@ -146,7 +145,7 @@ export const readTime = (value) => {
|
|
|
146
145
|
* ```
|
|
147
146
|
*/
|
|
148
147
|
export class ChikyuEarthRealistic extends HTMLElement {
|
|
149
|
-
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups"];
|
|
148
|
+
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "satellite-tint"];
|
|
150
149
|
#model = newModel();
|
|
151
150
|
#mode = "now";
|
|
152
151
|
#view;
|
|
@@ -445,6 +444,10 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
445
444
|
}
|
|
446
445
|
else if (COUNTRY_NAMES_ATTRIBUTES.includes(name))
|
|
447
446
|
this.#countries?.refresh();
|
|
447
|
+
else if (name === "satellite-tint") {
|
|
448
|
+
this.#model.satellites.orbitTint = value === "orbit";
|
|
449
|
+
this.#gate?.soon();
|
|
450
|
+
}
|
|
448
451
|
if (name === "air-thickness" || name === "air-label" || name === "lang")
|
|
449
452
|
setAirNote(this.#airNote, this, this.#model.airThickness);
|
|
450
453
|
}
|
|
@@ -943,10 +946,22 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
943
946
|
this.#gate?.soon();
|
|
944
947
|
}
|
|
945
948
|
// --- satellites ---------------------------------------------------------------------------------------------------------------------------------
|
|
949
|
+
/**
|
|
950
|
+
* Colour each satellite by its orbit class (low, medium, geostationary, highly elliptical, other). Off by default, so a group keeps the colour it was given. The attribute is `satellite-tint="orbit"`.
|
|
951
|
+
*/
|
|
952
|
+
get satelliteTint() {
|
|
953
|
+
return this.#model.satellites.orbitTint ? "orbit" : "off";
|
|
954
|
+
}
|
|
955
|
+
set satelliteTint(value) {
|
|
956
|
+
if (value === "orbit")
|
|
957
|
+
this.setAttribute("satellite-tint", "orbit");
|
|
958
|
+
else
|
|
959
|
+
this.removeAttribute("satellite-tint");
|
|
960
|
+
}
|
|
946
961
|
/**
|
|
947
962
|
* Show a group of satellites (made by `createSatellites`) under a name, or take the group away with `null`. A group is one draw call however many satellites it holds, so every group of the catalogue can be shown at once. Giving the name of a group
|
|
948
963
|
* that is already shown replaces it. `style`: `color` and `size` (CSS pixels) of the dots, and `orbits` to draw every orbit (only for a group of 40 or fewer, such as the stations). The groups are placed by SGP4 about once a second and interpolated
|
|
949
|
-
* between
|
|
964
|
+
* between. Above `MAX_SATELLITE_SPEED` each satellite is a short streak along its orbit instead of being hidden. They are hidden by the Earth when they are behind it, and draw at most 30 times a second and not at all while the clock holds.
|
|
950
965
|
*
|
|
951
966
|
* @param group - The group's name, for `showSatellites`, `selectSatellite` and the events.
|
|
952
967
|
* @param satellites - The group, or `null` to remove it.
|
|
@@ -997,7 +1012,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
997
1012
|
const chosen = this.#model.satellites.selected;
|
|
998
1013
|
return chosen ? { ...chosen } : null;
|
|
999
1014
|
}
|
|
1000
|
-
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period); undefined if it cannot be placed then. */
|
|
1015
|
+
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period, and `ownerCountry` when the owner is one country); undefined if it cannot be placed then. */
|
|
1001
1016
|
satelliteInfo(ref) {
|
|
1002
1017
|
return this.#model.satellites.groups.get(ref.group)?.satellites.info(ref.index, this.#model.time);
|
|
1003
1018
|
}
|
|
@@ -1011,7 +1026,10 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1011
1026
|
lastBatchMs = Math.max(lastBatchMs, group.satellites.timing.lastBatchMs);
|
|
1012
1027
|
maxBatchMs = Math.max(maxBatchMs, group.satellites.timing.maxBatchMs);
|
|
1013
1028
|
}
|
|
1014
|
-
|
|
1029
|
+
let epochMs = 0;
|
|
1030
|
+
for (const group of this.#model.satellites.groups.values())
|
|
1031
|
+
epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
|
|
1032
|
+
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates };
|
|
1015
1033
|
}
|
|
1016
1034
|
// A press that does not turn the view (under 6 pixels) on a satellite tells the page, which chooses it with `selectSatellite` if it likes.
|
|
1017
1035
|
#downX = 0;
|
|
@@ -1058,10 +1076,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1058
1076
|
const radius = this.#model.drawn?.radius ?? 200;
|
|
1059
1077
|
return Math.min(live, 1000 / Math.min(30, Math.max(1, (satellites ? SATELLITE_RATE : SUN_RATE) * RAD * speed * radius)));
|
|
1060
1078
|
}
|
|
1061
|
-
/** Is anything on show that moves faster than the Earth turns: a group of satellites the
|
|
1079
|
+
/** Is anything on show that moves faster than the Earth turns: a group of satellites, including above the interpolation limit where they are drawn as streaks? */
|
|
1062
1080
|
#satellitesMoving() {
|
|
1063
|
-
if (Math.abs(this.speed) > MAX_SATELLITE_SPEED)
|
|
1064
|
-
return false;
|
|
1065
1081
|
for (const group of this.#model.satellites.groups.values())
|
|
1066
1082
|
if (group.visible && group.satellites.count > 0)
|
|
1067
1083
|
return true;
|
|
@@ -17,6 +17,8 @@ export type ThreeParts = {
|
|
|
17
17
|
} & {
|
|
18
18
|
/** Only the satellites use it, so a loader that hands over a subset of three.js without it still draws everything else. */
|
|
19
19
|
Points?: typeof THREE.Points;
|
|
20
|
+
/** Only the satellites above 60 times real time use it, for their streaks: without it they are dots alone there, and one warning is written to the console. */
|
|
21
|
+
LineSegments?: typeof THREE.LineSegments;
|
|
20
22
|
} & {
|
|
21
23
|
/** Only the name written on the Earth (`body-label`) uses these, so a subset of three.js without them still draws everything else. */
|
|
22
24
|
CanvasTexture?: typeof THREE.CanvasTexture;
|
|
@@ -2,6 +2,7 @@ export { createSatellites, type SatellitesOptions } from "./track.ts";
|
|
|
2
2
|
export { DEFAULT_DIM_AFTER_DAYS, DEFAULT_MAX_AGE_DAYS, MAX_SATELLITE_SPEED } from "./limits.ts";
|
|
3
3
|
export type { ElementSet, RefusedElementSet, SatelliteInfo, SatelliteRef, Satellites } from "./types.ts";
|
|
4
4
|
export { SHORT_NAMES } from "./names.ts";
|
|
5
|
+
export { OWNER_COUNTRIES, ownerCountry } from "./owners.ts";
|
|
5
6
|
export { CATALOGUE, SATELLITE_GROUPS, catalogueEntry, findInCatalogue, type CatalogueEntry, type OrbitKind, type SatelliteGroupInfo } from "./catalogue.ts";
|
|
6
7
|
export { ElementSourceError, fetchElements, forgetElements, parseElements, type ElementFormat, type ElementSource, type FetchElementsOptions, type ParsedElements } from "./source.ts";
|
|
7
8
|
export { missionElements, missionOf, missionPosition, missions, type HubbleVisit, type Mission, type MissionFile, type MissionPosition, type Orbiter } from "./missions.ts";
|
package/dist/satellites/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export { createSatellites } from "./track.js";
|
|
3
3
|
export { DEFAULT_DIM_AFTER_DAYS, DEFAULT_MAX_AGE_DAYS, MAX_SATELLITE_SPEED } from "./limits.js";
|
|
4
4
|
export { SHORT_NAMES } from "./names.js";
|
|
5
|
+
export { OWNER_COUNTRIES, ownerCountry } from "./owners.js";
|
|
5
6
|
export { CATALOGUE, SATELLITE_GROUPS, catalogueEntry, findInCatalogue } from "./catalogue.js";
|
|
6
7
|
export { ElementSourceError, fetchElements, forgetElements, parseElements } from "./source.js";
|
|
7
8
|
export { missionElements, missionOf, missionPosition, missions } from "./missions.js";
|
|
@@ -21,7 +21,7 @@ export declare const DEFAULT_MAX_AGE_DAYS = 30;
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const DEFAULT_DIM_AFTER_DAYS = 14;
|
|
23
23
|
/**
|
|
24
|
-
* The fastest clock, in game seconds a second, at which
|
|
24
|
+
* The fastest clock, in game seconds a second, at which a group of satellites is still placed by interpolating two SGP4 samples. Above it those two moments would be too far apart, so each satellite is drawn as a short streak along its orbit instead: one SGP4 sample about once a second, turned along the orbit by its mean motion, covering the stretch one frame spans. Nothing is hidden. A satellite chosen with `selectSatellite` or ridden along is still placed exactly, one SGP4 call a frame.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```ts
|
|
@@ -22,7 +22,7 @@ export const DEFAULT_MAX_AGE_DAYS = 30;
|
|
|
22
22
|
*/
|
|
23
23
|
export const DEFAULT_DIM_AFTER_DAYS = 14;
|
|
24
24
|
/**
|
|
25
|
-
* The fastest clock, in game seconds a second, at which
|
|
25
|
+
* The fastest clock, in game seconds a second, at which a group of satellites is still placed by interpolating two SGP4 samples. Above it those two moments would be too far apart, so each satellite is drawn as a short streak along its orbit instead: one SGP4 sample about once a second, turned along the orbit by its mean motion, covering the stretch one frame spans. Nothing is hidden. A satellite chosen with `selectSatellite` or ridden along is still placed exactly, one SGP4 call a frame.
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```ts
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every owner code of the satellite catalogue with its country as an ISO 3166-1 alpha-2 code, or `null` where the owner is not one country: an organisation (`ESA`, `ISS`, `ITSO`, `SES`, `GLOB`, ...),
|
|
3
|
+
* several countries (`FGER`, France and Germany; `PRES`, China and ESA), not known (`UNK`, `TBD`), or not one country (`CIS`, the former Soviet registration). `ISRO`, India's space agency, is `IN`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { OWNER_COUNTRIES } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
8
|
+
*
|
|
9
|
+
* console.log(OWNER_COUNTRIES["PRC"], OWNER_COUNTRIES["ESA"], Object.keys(OWNER_COUNTRIES).length);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const OWNER_COUNTRIES: Readonly<Record<string, string | null>>;
|
|
13
|
+
/**
|
|
14
|
+
* The country of a satellite's owner code as an ISO 3166-1 alpha-2 code (`PRC` is `CN`, `PAKI` is `PK`, `US` is `US`), or `undefined` for an organisation, several countries, an ambiguous owner or a code that is not in the list.
|
|
15
|
+
*
|
|
16
|
+
* @param code - The owner code as the catalogue writes it (`COUNTRY_CODE` or `OWNER`): case and spaces round it do not matter.
|
|
17
|
+
* @returns The two-letter country code, or `undefined`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { ownerCountry } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
22
|
+
*
|
|
23
|
+
* console.log(ownerCountry("PRC"), ownerCountry("PAKI"), ownerCountry("ESA"), ownerCountry("XYZ"));
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function ownerCountry(code: string | null | undefined): string | undefined;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// The owner codes of the satellite catalogue and the country each stands for, as an ISO 3166-1 alpha-2 code, for a page that shows a flag or a country beside a satellite.
|
|
2
|
+
// Typed from the catalogue's published list of owner sources, read 2026-11-12 (credited in NOTICE.md): a code, and what it stands for. Pure data: no flag, no name.
|
|
3
|
+
/**
|
|
4
|
+
* Every owner code of the satellite catalogue with its country as an ISO 3166-1 alpha-2 code, or `null` where the owner is not one country: an organisation (`ESA`, `ISS`, `ITSO`, `SES`, `GLOB`, ...),
|
|
5
|
+
* several countries (`FGER`, France and Germany; `PRES`, China and ESA), not known (`UNK`, `TBD`), or not one country (`CIS`, the former Soviet registration). `ISRO`, India's space agency, is `IN`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { OWNER_COUNTRIES } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
10
|
+
*
|
|
11
|
+
* console.log(OWNER_COUNTRIES["PRC"], OWNER_COUNTRIES["ESA"], Object.keys(OWNER_COUNTRIES).length);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export const OWNER_COUNTRIES = {
|
|
15
|
+
AB: null, // Arab Satellite Communications Organization
|
|
16
|
+
ABS: null, // Asia Broadcast Satellite
|
|
17
|
+
AC: null, // Asia Satellite Telecommunications Company (ASIASAT)
|
|
18
|
+
ALG: "DZ", // Algeria
|
|
19
|
+
ANG: "AO", // Angola
|
|
20
|
+
ARGN: "AR", // Argentina
|
|
21
|
+
ARM: "AM", // Republic of Armenia
|
|
22
|
+
ASRA: "AT", // Austria
|
|
23
|
+
AUS: "AU", // Australia
|
|
24
|
+
AZER: "AZ", // Azerbaijan
|
|
25
|
+
BEL: "BE", // Belgium
|
|
26
|
+
BELA: "BY", // Belarus
|
|
27
|
+
BERM: "BM", // Bermuda
|
|
28
|
+
BGD: "BD", // Peoples Republic of Bangladesh
|
|
29
|
+
BHR: "BH", // The Kingdom of Bahrain
|
|
30
|
+
BHUT: "BT", // The Kingdom of Bhutan
|
|
31
|
+
BOL: "BO", // Bolivia
|
|
32
|
+
BRAZ: "BR", // Brazil
|
|
33
|
+
BUL: "BG", // Bulgaria
|
|
34
|
+
BWA: "BW", // Republic of Botswana
|
|
35
|
+
CA: "CA", // Canada
|
|
36
|
+
CHBZ: null, // China/Brazil
|
|
37
|
+
CHTU: null, // China/Türkiye
|
|
38
|
+
CHLE: "CL", // Chile
|
|
39
|
+
CIS: null, // Commonwealth of Independent States (former USSR): the list names no one country, so none
|
|
40
|
+
COL: "CO", // Colombia
|
|
41
|
+
CRI: "CR", // Republic of Costa Rica
|
|
42
|
+
CZCH: "CZ", // Czech Republic (former Czechoslovakia)
|
|
43
|
+
DEN: "DK", // Denmark
|
|
44
|
+
DJI: "DJ", // Republic of Djibouti
|
|
45
|
+
ECU: "EC", // Ecuador
|
|
46
|
+
EGYP: "EG", // Egypt
|
|
47
|
+
ESA: null, // European Space Agency
|
|
48
|
+
ESRO: null, // European Space Research Organization
|
|
49
|
+
EST: "EE", // Estonia
|
|
50
|
+
ETH: "ET", // Ethiopia
|
|
51
|
+
EUME: null, // European Organization for the Exploitation of Meteorological Satellites (EUMETSAT)
|
|
52
|
+
EUTE: null, // European Telecommunications Satellite Organization (EUTELSAT)
|
|
53
|
+
FGER: null, // France/Germany
|
|
54
|
+
FIN: "FI", // Finland
|
|
55
|
+
FR: "FR", // France
|
|
56
|
+
FRIT: null, // France/Italy
|
|
57
|
+
GER: "DE", // Germany
|
|
58
|
+
GHA: "GH", // Republic of Ghana
|
|
59
|
+
GLOB: null, // Globalstar
|
|
60
|
+
GREC: "GR", // Greece
|
|
61
|
+
GRSA: null, // Greece/Saudi Arabia
|
|
62
|
+
GUAT: "GT", // Guatemala
|
|
63
|
+
HRV: "HR", // Republic of Croatia
|
|
64
|
+
HUN: "HU", // Hungary
|
|
65
|
+
IM: null, // International Mobile Satellite Organization (INMARSAT)
|
|
66
|
+
IND: "IN", // India
|
|
67
|
+
INDO: "ID", // Indonesia
|
|
68
|
+
IRAN: "IR", // Iran
|
|
69
|
+
IRAQ: "IQ", // Iraq
|
|
70
|
+
IRID: null, // Iridium
|
|
71
|
+
IRL: "IE", // Ireland
|
|
72
|
+
ISRA: "IL", // Israel
|
|
73
|
+
ISRO: "IN", // Indian Space Research Organisation: one country's agency
|
|
74
|
+
ISS: null, // International Space Station
|
|
75
|
+
IT: "IT", // Italy
|
|
76
|
+
ITSO: null, // International Telecommunications Satellite Organization (INTELSAT)
|
|
77
|
+
JPN: "JP", // Japan
|
|
78
|
+
KAZ: "KZ", // Kazakhstan
|
|
79
|
+
KEN: "KE", // Republic of Kenya
|
|
80
|
+
LAOS: "LA", // Laos
|
|
81
|
+
LKA: "LK", // Democratic Socialist Republic of Sri Lanka
|
|
82
|
+
LTU: "LT", // Lithuania
|
|
83
|
+
LUXE: "LU", // Luxembourg
|
|
84
|
+
MA: "MA", // Morocco
|
|
85
|
+
MALA: "MY", // Malaysia
|
|
86
|
+
MCO: "MC", // Principality of Monaco
|
|
87
|
+
MDA: "MD", // Republic of Moldova
|
|
88
|
+
MEX: "MX", // Mexico
|
|
89
|
+
MMR: "MM", // Republic of the Union of Myanmar
|
|
90
|
+
MNE: "ME", // Montenegro
|
|
91
|
+
MNG: "MN", // Mongolia
|
|
92
|
+
MUS: "MU", // Mauritius
|
|
93
|
+
NATO: null, // North Atlantic Treaty Organization
|
|
94
|
+
NETH: "NL", // Netherlands
|
|
95
|
+
NICO: null, // New ICO
|
|
96
|
+
NIG: "NG", // Nigeria
|
|
97
|
+
NKOR: "KP", // Democratic People's Republic of Korea
|
|
98
|
+
NOR: "NO", // Norway
|
|
99
|
+
NPL: "NP", // Federal Democratic Republic of Nepal
|
|
100
|
+
NZ: "NZ", // New Zealand
|
|
101
|
+
O3B: null, // O3b Networks
|
|
102
|
+
ORB: null, // ORBCOMM
|
|
103
|
+
PAKI: "PK", // Pakistan
|
|
104
|
+
PERU: "PE", // Peru
|
|
105
|
+
POL: "PL", // Poland
|
|
106
|
+
POR: "PT", // Portugal
|
|
107
|
+
PRC: "CN", // People's Republic of China
|
|
108
|
+
PRY: "PY", // Republic of Paraguay
|
|
109
|
+
PRES: null, // People's Republic of China/European Space Agency
|
|
110
|
+
QAT: "QA", // State of Qatar
|
|
111
|
+
RASC: null, // RascomStar-QAF
|
|
112
|
+
ROC: "TW", // Taiwan (Republic of China)
|
|
113
|
+
ROM: "RO", // Romania
|
|
114
|
+
RP: "PH", // Philippines (Republic of the Philippines)
|
|
115
|
+
RWA: "RW", // Republic of Rwanda
|
|
116
|
+
SAFR: "ZA", // South Africa
|
|
117
|
+
SAUD: "SA", // Saudi Arabia
|
|
118
|
+
SDN: "SD", // Republic of Sudan
|
|
119
|
+
SEAL: null, // Sea Launch
|
|
120
|
+
SEN: "SN", // Republic of Senegal
|
|
121
|
+
SES: null, // SES
|
|
122
|
+
SGJP: null, // Singapore/Japan
|
|
123
|
+
SING: "SG", // Singapore
|
|
124
|
+
SKOR: "KR", // Republic of Korea
|
|
125
|
+
SLB: "SB", // Solomon Islands
|
|
126
|
+
SPN: "ES", // Spain
|
|
127
|
+
STCT: null, // Singapore/Taiwan
|
|
128
|
+
SVN: "SI", // Slovenia
|
|
129
|
+
SWED: "SE", // Sweden
|
|
130
|
+
SWTZ: "CH", // Switzerland
|
|
131
|
+
TBD: null, // To Be Determined
|
|
132
|
+
THAI: "TH", // Thailand
|
|
133
|
+
TMMC: null, // Turkmenistan/Monaco
|
|
134
|
+
TUN: "TN", // Republic of Tunisia
|
|
135
|
+
TURK: "TR", // Türkiye
|
|
136
|
+
UAE: "AE", // United Arab Emirates
|
|
137
|
+
UK: "GB", // United Kingdom
|
|
138
|
+
UKR: "UA", // Ukraine
|
|
139
|
+
UNK: null, // Unknown
|
|
140
|
+
URY: "UY", // Uruguay
|
|
141
|
+
US: "US", // United States
|
|
142
|
+
USBZ: null, // United States/Brazil
|
|
143
|
+
VAT: "VA", // Vatican City State
|
|
144
|
+
VENZ: "VE", // Venezuela
|
|
145
|
+
VTNM: "VN", // Vietnam
|
|
146
|
+
ZWE: "ZW", // Republic of Zimbabwe
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* The country of a satellite's owner code as an ISO 3166-1 alpha-2 code (`PRC` is `CN`, `PAKI` is `PK`, `US` is `US`), or `undefined` for an organisation, several countries, an ambiguous owner or a code that is not in the list.
|
|
150
|
+
*
|
|
151
|
+
* @param code - The owner code as the catalogue writes it (`COUNTRY_CODE` or `OWNER`): case and spaces round it do not matter.
|
|
152
|
+
* @returns The two-letter country code, or `undefined`.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* import { ownerCountry } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
157
|
+
*
|
|
158
|
+
* console.log(ownerCountry("PRC"), ownerCountry("PAKI"), ownerCountry("ESA"), ownerCountry("XYZ"));
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
export function ownerCountry(code) {
|
|
162
|
+
const key = (code ?? "").trim().toUpperCase();
|
|
163
|
+
return (Object.hasOwn(OWNER_COUNTRIES, key) ? OWNER_COUNTRIES[key] : undefined) ?? undefined;
|
|
164
|
+
}
|
|
@@ -9,6 +9,9 @@ export function toElementSet(record) {
|
|
|
9
9
|
out["OBJECT_ID"] = record["OBJECT_ID"];
|
|
10
10
|
if (typeof record["CLASSIFICATION_TYPE"] === "string" && record["CLASSIFICATION_TYPE"])
|
|
11
11
|
out["CLASSIFICATION_TYPE"] = record["CLASSIFICATION_TYPE"];
|
|
12
|
+
for (const key of ["COUNTRY_CODE", "OWNER"])
|
|
13
|
+
if (typeof record[key] === "string" && record[key].trim())
|
|
14
|
+
out[key] = record[key].trim();
|
|
12
15
|
const epoch = record["EPOCH"];
|
|
13
16
|
if (typeof epoch !== "string" || !Number.isFinite(Date.parse(/[zZ]|[+-]\d\d:?\d\d$/.test(epoch) ? epoch : `${epoch}Z`)))
|
|
14
17
|
return "the epoch is missing or is not a date";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { ElementSet, Satellites } from "./types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* From this eccentricity up, a satellite is not turned about its orbit's axis at the mean motion above the interpolation limit, because it does not go round at a steady rate or stay at one height
|
|
4
|
+
* (a Molniya orbit is 10 times quicker at its lowest point than its mean): its place and its streak are SGP4 itself, two calls a frame, for the few that are this eccentric.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ECCENTRIC_FROM = 0.02;
|
|
2
7
|
/**
|
|
3
8
|
* What `createSatellites` can be told.
|
|
4
9
|
*
|