Fix geocron satellite rendering for full user lists
This commit is contained in:
@@ -97,11 +97,37 @@
|
||||
const rows = await res.json();
|
||||
if (rows.error) throw new Error("TLE-DB-Fehler: " + rows.error);
|
||||
|
||||
function createSatrec(row) {
|
||||
if (typeof satellite.json2satrec === "function") {
|
||||
return satellite.json2satrec({
|
||||
OBJECT_NAME: row.object_name ?? String(row.norad_cat_id),
|
||||
OBJECT_ID: row.object_id ?? "",
|
||||
EPOCH: row.epoch,
|
||||
MEAN_MOTION: Number(row.mean_motion ?? 0),
|
||||
ECCENTRICITY: Number(row.eccentricity ?? 0),
|
||||
INCLINATION: Number(row.inclination ?? 0),
|
||||
RA_OF_ASC_NODE: Number(row.ra_of_asc_node ?? 0),
|
||||
ARG_OF_PERICENTER: Number(row.arg_of_pericenter ?? 0),
|
||||
MEAN_ANOMALY: Number(row.mean_anomaly ?? 0),
|
||||
EPHEMERIS_TYPE: Number(row.ephemeris_type ?? 0),
|
||||
CLASSIFICATION_TYPE: row.classification_type ?? "U",
|
||||
NORAD_CAT_ID: Number(row.norad_cat_id),
|
||||
ELEMENT_SET_NO: Number(row.element_set_no ?? 0),
|
||||
REV_AT_EPOCH: Number(row.rev_at_epoch ?? 0),
|
||||
BSTAR: Number(row.bstar ?? 0),
|
||||
MEAN_MOTION_DOT: Number(row.mean_motion_dot ?? 0),
|
||||
MEAN_MOTION_DDOT: Number(row.mean_motion_ddot ?? 0),
|
||||
});
|
||||
}
|
||||
|
||||
return satellite.twoline2satrec(row.tle_line1, row.tle_line2);
|
||||
}
|
||||
|
||||
satrecs = rows.map(r => ({
|
||||
id: Number(r.norad_cat_id),
|
||||
name: r.object_name ?? String(r.norad_cat_id),
|
||||
isFavorite: Boolean(r.is_favorite),
|
||||
satrec: satellite.twoline2satrec(r.tle_line1, r.tle_line2),
|
||||
satrec: createSatrec(r),
|
||||
}));
|
||||
|
||||
await Promise.all(satrecs.map(s => loadSatIcon(s.id)));
|
||||
@@ -115,7 +141,7 @@
|
||||
|
||||
function currentLatLon(satrec, date) {
|
||||
const pv = satellite.propagate(satrec, date);
|
||||
if (!pv.position) return null;
|
||||
if (!pv || !pv.position) return null;
|
||||
const gmst = satellite.gstime(date);
|
||||
const gd = satellite.eciToGeodetic(pv.position, gmst);
|
||||
const v = pv.velocity;
|
||||
|
||||
Reference in New Issue
Block a user