Files
gods-eye-view/src/layers/satellites/source.js
T
Denis Groshev fe5470a852 feat(cockpit): zoom the orbital view to the imaging sensor's swath
An imaging satellite with a known sensor can now zoom past 8x, up to 128x,
as far as the view stays at least as wide as the sensor's narrowest
standard swath at its live altitude; only swaths confirmed on a cited page
open those steps. The top step follows the altitude and window shape and
steps back when it falls below the zoom shown.

The view draws the sensor's swath to scale along the ground track with a
SENSOR SWATH readout (approximate off nadir), and a SENSOR button zooms to
exactly that width when it lies in range at nadir. From 16x the imagery
tiles the view will need 5 to 20 s ahead along the ground track are
pre-loaded at the matching level. The mouse wheel steps the zoom one notch
at a time, and the identity line shows how old the TLE is. The sensor
figures come from a new bundled pack of 46 Earth-observation platforms,
each value cited to its operator or agency, with its own data credit.
2026-11-09 00:25:06 +01:00

77 lines
2.5 KiB
JavaScript

const GROUPS = new Set([
'stations',
'visual',
'gps-ops',
'glo-ops',
'galileo',
'geo',
'starlink',
// Imaging coverage beyond the UCS May 2023 snapshot, and science probes.
'resource',
'weather',
'planet',
'sar',
'science',
]);
/** The UCS pack, loaded on first use (see src/data/ucsSatellites.js). */
async function loadBundledUcs() {
const { loadUcsSatellites } = await import('../../data/ucsSatellites.js');
return loadUcsSatellites();
}
/** The imaging-sensor pack, loaded on first use (see src/data/imagingSensors.js). */
async function loadBundledSensors() {
const { loadImagingSensors } = await import('../../data/imagingSensors.js');
return loadImagingSensors();
}
/** Read catalog text from the existing group endpoint using a supplied transport. */
export function createSatelliteSource({
fetchImpl = (...args) => globalThis.fetch(...args),
loadUcs = loadBundledUcs,
loadSensors = loadBundledSensors,
} = {}) {
return {
async readGroup(group, { signal } = {}) {
if (!GROUPS.has(group)) throw new TypeError('Unknown satellite group');
signal?.throwIfAborted();
const response = await fetchImpl(`/api/celestrak/${group}`, { signal });
const text = response.ok ? await response.text() : '';
signal?.throwIfAborted();
// The proxy serves its last copy, marked STALE-ERROR, when CelesTrak
// is down.
const stale = response.headers?.get?.('x-tle-cache') === 'STALE-ERROR';
return { ok: response.ok, status: response.status, text, stale };
},
/**
* CelesTrak SATCAT records (CSV) for one group: object type, operational
* status and owner, through the proxy's day-long cache.
*/
async readSatcat(group, { signal } = {}) {
if (!GROUPS.has(group)) throw new TypeError('Unknown satellite group');
signal?.throwIfAborted();
const response = await fetchImpl(`/api/celestrak-satcat/${group}`, {
signal,
});
const text = response.ok ? await response.text() : '';
signal?.throwIfAborted();
// The proxy serves its last copy, marked STALE-ERROR, when CelesTrak
// is down.
const stale = response.headers?.get?.('x-satcat-cache') === 'STALE-ERROR';
return { ok: response.ok, status: response.status, text, stale };
},
/** The UCS Satellite Database pack, keyed by NORAD number. */
readUcs() {
return loadUcs();
},
/** The imaging-sensor pack, indexed by NORAD number and name pattern. */
readSensors() {
return loadSensors();
},
};
}