@johnmorrisdotca/chikyu-earth 0.36.0 → 0.38.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 +15 -0
- package/NOTICE.md +6 -1
- 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/markers/place-layer.d.ts +12 -1
- package/dist/markers/place-layer.js +88 -18
- package/dist/markers/place-sprites.d.ts +5 -0
- package/dist/markers/place-sprites.js +8 -0
- package/dist/paint/buffer.d.ts +53 -0
- package/dist/paint/buffer.js +238 -0
- package/dist/paint/math.d.ts +24 -0
- package/dist/paint/math.js +94 -0
- package/dist/paint/texture.d.ts +24 -0
- package/dist/paint/texture.js +33 -0
- package/dist/realistic/earth.d.ts +9 -0
- package/dist/realistic/earth.js +20 -11
- package/dist/realistic/element.d.ts +36 -3
- package/dist/realistic/element.js +82 -14
- package/dist/realistic/shaders.js +13 -0
- 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 +146 -3
- package/dist/satellites/types.d.ts +22 -1
- package/dist/space/element.d.ts +56 -6
- package/dist/space/element.js +171 -16
- 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 +32 -2
- package/dist/space/satellite-layer.js +178 -19
- package/dist/space/scene.d.ts +12 -1
- package/dist/space/scene.js +27 -16
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ 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 {
|
|
10
|
+
import { createPaintState, paintedGround } from "../paint/buffer.js";
|
|
11
11
|
import { MAX_ORBIT_GROUP } from "../space/satellite-layer.js";
|
|
12
12
|
import { readMeteorStrength } from "../meteors/strength.js";
|
|
13
13
|
import { METEOR_NOTE_STYLE, prefersLessMotion, setMeteorNote } from "../meteors/note.js";
|
|
@@ -17,7 +17,7 @@ import { ownCredit } from "../door/own.js";
|
|
|
17
17
|
import { BODY_LABEL_ATTRIBUTES, bodyLabelText, loadMichroma, readBodyLabel } from "./body-label.js";
|
|
18
18
|
import { createSkyHost, SKY_ATTRIBUTES, SKY_STYLE } from "../sky/host.js";
|
|
19
19
|
import { cleanPlaces, orthoView, readPlaceGroups, readPlaces } from "../markers/places.js";
|
|
20
|
-
import { createPlaceLayer, PLACE_STYLE, readPlaceLook } from "../markers/place-layer.js";
|
|
20
|
+
import { createPlaceLayer, PLACE_STYLE, placesLostNotice, readPlaceLook } from "../markers/place-layer.js";
|
|
21
21
|
import { aimAt, findPlace, glideView } from "../markers/go-to-place.js";
|
|
22
22
|
import { subsolarPoint } from "./sun.js";
|
|
23
23
|
import { CITY_NAMES_ATTRIBUTES, CITY_NAMES_STYLE, createCityHost } from "../cities/host.js";
|
|
@@ -138,6 +138,9 @@ export const readTime = (value) => {
|
|
|
138
138
|
* earth.setAttribute("texture-base", "/textures/");
|
|
139
139
|
* earth.setAttribute("tiles", "/tiles/");
|
|
140
140
|
* earth.setAttribute("speed", "86400");
|
|
141
|
+
* earth.placeGroups = false; // place-groups="off": every place keeps its own ring
|
|
142
|
+
* earth.paint = { id: "25544", length: "1d", swath: "track" };
|
|
143
|
+
* earth.clearPaint();
|
|
141
144
|
* earth.addEventListener("chikyu-timechange", (event) => {
|
|
142
145
|
* const { time, running } = (event as CustomEvent<{ time: number; running: boolean }>).detail;
|
|
143
146
|
* console.log(new Date(time).toISOString(), running ? "running" : "held");
|
|
@@ -146,8 +149,9 @@ export const readTime = (value) => {
|
|
|
146
149
|
* ```
|
|
147
150
|
*/
|
|
148
151
|
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"];
|
|
152
|
+
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
153
|
#model = newModel();
|
|
154
|
+
#paint = createPaintState();
|
|
151
155
|
#mode = "now";
|
|
152
156
|
#view;
|
|
153
157
|
#gate;
|
|
@@ -178,6 +182,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
178
182
|
#countriesStyle = {};
|
|
179
183
|
#listeners = new Set();
|
|
180
184
|
#placeLayer;
|
|
185
|
+
/** Whether the page has been told that places in sight were left undrawn. */
|
|
186
|
+
#placesLost = { told: false };
|
|
181
187
|
#placeList = [];
|
|
182
188
|
/** Counts the turns to a place, so a new one stops the one before. */
|
|
183
189
|
#placeGlide = 0;
|
|
@@ -311,12 +317,22 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
311
317
|
finally {
|
|
312
318
|
this.#posing = false;
|
|
313
319
|
}
|
|
314
|
-
if (this.#placeLayer && (this.#placeList.length > 0 || this.#placeLayer.stats.shown > 0))
|
|
320
|
+
if (this.#placeLayer && (this.#placeList.length > 0 || this.#placeLayer.stats.shown > 0)) {
|
|
315
321
|
this.#placeLayer.frame(orthoView(pose), [], [], this.#model.light === "lit" ? null : subsolarPoint(this.#model.time));
|
|
322
|
+
this.#notePlacesLost();
|
|
323
|
+
}
|
|
316
324
|
this.#cityFrame();
|
|
317
325
|
},
|
|
318
326
|
onPlaceRings: (drawn) => this.#ringsDrawn(drawn),
|
|
319
327
|
onSatellitesError: (error) => this.dispatchEvent(new CustomEvent("chikyu-satellites-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
|
|
328
|
+
paint: {
|
|
329
|
+
data: this.#paint.data,
|
|
330
|
+
width: this.#paint.width,
|
|
331
|
+
height: this.#paint.height,
|
|
332
|
+
step: (ms) => this.#paint.step(ms, (at) => paintedGround(this.#model.satellites.groups, this.#paint.id, at)),
|
|
333
|
+
span: () => this.#paint.spanMinutes,
|
|
334
|
+
on: () => this.#paint.on,
|
|
335
|
+
},
|
|
320
336
|
onError: (error) => this.#fail(error instanceof Error ? error.message : String(error)),
|
|
321
337
|
onTier: (layer, width) => {
|
|
322
338
|
if (layer in this.#tiers)
|
|
@@ -445,6 +461,10 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
445
461
|
}
|
|
446
462
|
else if (COUNTRY_NAMES_ATTRIBUTES.includes(name))
|
|
447
463
|
this.#countries?.refresh();
|
|
464
|
+
else if (name === "satellite-tint") {
|
|
465
|
+
this.#model.satellites.orbitTint = value === "orbit";
|
|
466
|
+
this.#gate?.soon();
|
|
467
|
+
}
|
|
448
468
|
if (name === "air-thickness" || name === "air-label" || name === "lang")
|
|
449
469
|
setAirNote(this.#airNote, this, this.#model.airThickness);
|
|
450
470
|
}
|
|
@@ -606,6 +626,17 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
606
626
|
}
|
|
607
627
|
/**
|
|
608
628
|
* Whether places that crowd are gathered into one ring with their count (the attribute `place-groups`): on by default, `off` leaves every place its own ring. Setting the property writes the attribute.
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* ```ts no-run
|
|
632
|
+
* import type { ChikyuEarthRealistic } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
633
|
+
*
|
|
634
|
+
* const earth = document.querySelector("chikyu-earth-realistic") as ChikyuEarthRealistic;
|
|
635
|
+
* earth.placeGroups = false;
|
|
636
|
+
* earth.getAttribute("place-groups"); // "off"
|
|
637
|
+
* earth.placeGroups = true;
|
|
638
|
+
* earth.hasAttribute("place-groups"); // false
|
|
639
|
+
* ```
|
|
609
640
|
*/
|
|
610
641
|
get placeGroups() {
|
|
611
642
|
return this.#placeLayer?.grouping ?? readPlaceGroups(this.getAttribute("place-groups"));
|
|
@@ -616,15 +647,20 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
616
647
|
else
|
|
617
648
|
this.setAttribute("place-groups", "off");
|
|
618
649
|
}
|
|
619
|
-
/** The picture said whether it can draw the rings of the places that are not markers of their own. Without `Points` the places' layer draws them itself
|
|
650
|
+
/** The picture said whether it can draw the rings of the places that are not markers of their own. Without `Points` the places' layer draws them itself. */
|
|
620
651
|
#ringsDrawn(drawn) {
|
|
621
652
|
if (!this.#placeLayer || this.#placeLayer.ringsInPicture === drawn)
|
|
622
653
|
return;
|
|
623
654
|
this.#placeLayer.ringsInPicture = drawn;
|
|
624
|
-
if (!drawn)
|
|
625
|
-
this.dispatchEvent(new CustomEvent("chikyu-places-unavailable", { detail: { reason: "the three.js parts handed over lack Points: the places' rings are drawn as small circles in the page, at most 600, and stats.places.omitted counts the rest" } }));
|
|
626
655
|
this.#gate?.soon();
|
|
627
656
|
}
|
|
657
|
+
/** Tell the page once when places in sight had no room among the fallback circles. Missing `Points` alone leaves them drawn, so it says nothing. */
|
|
658
|
+
#notePlacesLost() {
|
|
659
|
+
const notice = placesLostNotice(this.#placesLost, this.#placeLayer?.stats.omitted ?? 0);
|
|
660
|
+
if (!notice)
|
|
661
|
+
return;
|
|
662
|
+
this.dispatchEvent(new CustomEvent("chikyu-places-unavailable", { detail: notice }));
|
|
663
|
+
}
|
|
628
664
|
/** How the places are drawn (the attribute `places-look`): `beam` (a light rising out of the ground with a ring at its foot, the default), `pin` (a thin stick with a round head) or `ring` (only the ring on the ground). */
|
|
629
665
|
get placesLook() {
|
|
630
666
|
return this.#placeLayer?.look ?? readPlaceLook(this.getAttribute("places-look"));
|
|
@@ -917,7 +953,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
917
953
|
meteors: { on: this.#model.meteors.on, strength: this.#model.meteors.strength, ...this.#model.meteors.drawn },
|
|
918
954
|
bodyLabel: { on: this.#model.bodyLabel.settings !== null, text: this.#model.bodyLabel.text, ...this.#model.bodyLabel.drawn },
|
|
919
955
|
sky: this.#sky?.stats ?? { on: false, loaded: false, names: 0, figures: 0, picked: null, pick: null, hover: null, constellations: 0, culture: "iau", renders: 0, lang: "", stars: [] },
|
|
920
|
-
places: { ...(this.#placeLayer?.stats ?? { places: 0, shown: 0, labels: 0, renders: 0, marks: 0, groups: 0, sprites: 0, omitted: 0 }) },
|
|
956
|
+
places: { ...(this.#placeLayer?.stats ?? { places: 0, shown: 0, labels: 0, renders: 0, marks: 0, groups: 0, sprites: 0, dots: 0, omitted: 0 }) },
|
|
921
957
|
cityNames: this.#cities?.stats ?? { on: false, max: 0, radius: 0, tiers: [], cities: 0, names: 0, renders: 0 },
|
|
922
958
|
borders: { ...this.#model.borders.stats, shown: { ...this.#model.borders.stats.shown }, loaded: [...this.#model.borders.stats.loaded] },
|
|
923
959
|
grid: { ...this.#model.grid.stats },
|
|
@@ -943,15 +979,46 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
943
979
|
this.#gate?.soon();
|
|
944
980
|
}
|
|
945
981
|
// --- satellites ---------------------------------------------------------------------------------------------------------------------------------
|
|
982
|
+
/**
|
|
983
|
+
* 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"`.
|
|
984
|
+
*/
|
|
985
|
+
get satelliteTint() {
|
|
986
|
+
return this.#model.satellites.orbitTint ? "orbit" : "off";
|
|
987
|
+
}
|
|
988
|
+
set satelliteTint(value) {
|
|
989
|
+
if (value === "orbit")
|
|
990
|
+
this.setAttribute("satellite-tint", "orbit");
|
|
991
|
+
else
|
|
992
|
+
this.removeAttribute("satellite-tint");
|
|
993
|
+
}
|
|
946
994
|
/**
|
|
947
995
|
* 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
996
|
* 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
|
|
997
|
+
* 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
998
|
*
|
|
951
999
|
* @param group - The group's name, for `showSatellites`, `selectSatellite` and the events.
|
|
952
1000
|
* @param satellites - The group, or `null` to remove it.
|
|
953
1001
|
* @param style - How to draw it.
|
|
954
1002
|
*/
|
|
1003
|
+
/**
|
|
1004
|
+
* Paint one satellite's path on the Earth. `id` is a NORAD catalogue number or `group:index`. `length` is how long the trail is kept, in simulated time (`1d` when left out, or `1w`, `1m`). `swath` is `track` (the point under the satellite, the default) or `coverage` (where it is at least 10° above the horizon). Setting another satellite clears the trail. `null` clears it.
|
|
1005
|
+
*/
|
|
1006
|
+
get paint() {
|
|
1007
|
+
return this.#paint.on ? { id: this.#paint.id, length: this.#paint.length, swath: this.#paint.swath } : null;
|
|
1008
|
+
}
|
|
1009
|
+
set paint(value) {
|
|
1010
|
+
this.#paint.set(value);
|
|
1011
|
+
this.#gate?.soon();
|
|
1012
|
+
}
|
|
1013
|
+
/** Take the painted trail off the Earth. */
|
|
1014
|
+
clearPaint() {
|
|
1015
|
+
this.#paint.clear();
|
|
1016
|
+
this.#gate?.soon();
|
|
1017
|
+
}
|
|
1018
|
+
/** Texels the trail has painted. 0 after `clearPaint`, and again when the painted satellite changes. */
|
|
1019
|
+
get paintPixels() {
|
|
1020
|
+
return this.#paint.pixels;
|
|
1021
|
+
}
|
|
955
1022
|
setSatellites(group, satellites, style = {}) {
|
|
956
1023
|
const groups = this.#model.satellites.groups;
|
|
957
1024
|
if (satellites === null) {
|
|
@@ -997,7 +1064,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
997
1064
|
const chosen = this.#model.satellites.selected;
|
|
998
1065
|
return chosen ? { ...chosen } : null;
|
|
999
1066
|
}
|
|
1000
|
-
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period); undefined if it cannot be placed then. */
|
|
1067
|
+
/** 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
1068
|
satelliteInfo(ref) {
|
|
1002
1069
|
return this.#model.satellites.groups.get(ref.group)?.satellites.info(ref.index, this.#model.time);
|
|
1003
1070
|
}
|
|
@@ -1011,7 +1078,10 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1011
1078
|
lastBatchMs = Math.max(lastBatchMs, group.satellites.timing.lastBatchMs);
|
|
1012
1079
|
maxBatchMs = Math.max(maxBatchMs, group.satellites.timing.maxBatchMs);
|
|
1013
1080
|
}
|
|
1014
|
-
|
|
1081
|
+
let epochMs = 0;
|
|
1082
|
+
for (const group of this.#model.satellites.groups.values())
|
|
1083
|
+
epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
|
|
1084
|
+
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
1085
|
}
|
|
1016
1086
|
// 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
1087
|
#downX = 0;
|
|
@@ -1058,10 +1128,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1058
1128
|
const radius = this.#model.drawn?.radius ?? 200;
|
|
1059
1129
|
return Math.min(live, 1000 / Math.min(30, Math.max(1, (satellites ? SATELLITE_RATE : SUN_RATE) * RAD * speed * radius)));
|
|
1060
1130
|
}
|
|
1061
|
-
/** Is anything on show that moves faster than the Earth turns: a group of satellites the
|
|
1131
|
+
/** 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
1132
|
#satellitesMoving() {
|
|
1063
|
-
if (Math.abs(this.speed) > MAX_SATELLITE_SPEED)
|
|
1064
|
-
return false;
|
|
1065
1133
|
for (const group of this.#model.satellites.groups.values())
|
|
1066
1134
|
if (group.visible && group.satellites.count > 0)
|
|
1067
1135
|
return true;
|
|
@@ -31,6 +31,10 @@ uniform float cloudShift;
|
|
|
31
31
|
uniform float lights;
|
|
32
32
|
uniform float boost;
|
|
33
33
|
uniform float ortho;
|
|
34
|
+
uniform sampler2D paintMap;
|
|
35
|
+
uniform float paintNow;
|
|
36
|
+
uniform float paintSpan;
|
|
37
|
+
uniform float paintOn;
|
|
34
38
|
${tile ? "uniform vec4 nightRect;\nvarying vec2 vUvG;" : ""}
|
|
35
39
|
varying vec2 vUv;
|
|
36
40
|
varying vec3 vNormal;
|
|
@@ -82,6 +86,15 @@ void main() {
|
|
|
82
86
|
night += vec3(0.04, 0.08, 0.20) * smoothstep(-0.20, -0.06, ndl) * (1.0 - smoothstep(-0.06, 0.06, ndl)) * 0.28;
|
|
83
87
|
vec3 col = mix(night, lit, day);
|
|
84
88
|
col += pow(albedo, vec3(0.75)) * boost * 0.65 * (1.0 - day);
|
|
89
|
+
if (paintOn > 0.5) {
|
|
90
|
+
vec4 stamp = texture2D(paintMap, ${tile ? "vUvG" : "vUv"});
|
|
91
|
+
float then = floor(stamp.r * 255.0 + 0.5) * 256.0 + floor(stamp.g * 255.0 + 0.5);
|
|
92
|
+
float age = paintNow - then;
|
|
93
|
+
if (age < -32768.0) age += 65536.0;
|
|
94
|
+
if (age > 32768.0) age -= 65536.0;
|
|
95
|
+
float show = stamp.a * step(-1.0, age) * (1.0 - smoothstep(paintSpan * 0.82, paintSpan, age));
|
|
96
|
+
col = mix(col, vec3(1.0, 0.55, 0.12), clamp(show, 0.0, 0.92));
|
|
97
|
+
}
|
|
85
98
|
|
|
86
99
|
gl_FragColor = vec4(col, 1.0);
|
|
87
100
|
}`;
|
|
@@ -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
|
*
|