Fix geocron satellite rendering for full user lists
This commit is contained in:
@@ -201,7 +201,22 @@ foreach ($rows as $row) {
|
||||
'id' => (int)$row['id'],
|
||||
'norad_cat_id' => (int)$row['norad_cat_id'],
|
||||
'object_name' => (string)$row['object_name'],
|
||||
'object_id' => $row['object_id'] !== null ? (string)$row['object_id'] : null,
|
||||
'classification_type' => $row['classification_type'] !== null ? (string)$row['classification_type'] : null,
|
||||
'is_favorite' => (int)($row['is_favorite'] ?? 0) === 1,
|
||||
'epoch' => (string)$row['epoch'],
|
||||
'mean_motion' => (float)$row['mean_motion'],
|
||||
'eccentricity' => (float)$row['eccentricity'],
|
||||
'inclination' => (float)$row['inclination'],
|
||||
'ra_of_asc_node' => (float)$row['ra_of_asc_node'],
|
||||
'arg_of_pericenter' => (float)$row['arg_of_pericenter'],
|
||||
'mean_anomaly' => (float)$row['mean_anomaly'],
|
||||
'ephemeris_type' => (int)$row['ephemeris_type'],
|
||||
'element_set_no' => (int)$row['element_set_no'],
|
||||
'rev_at_epoch' => (int)$row['rev_at_epoch'],
|
||||
'bstar' => (float)$row['bstar'],
|
||||
'mean_motion_dot' => (float)$row['mean_motion_dot'],
|
||||
'mean_motion_ddot' => (float)$row['mean_motion_ddot'],
|
||||
'tle_line1' => buildLine1($row, $row),
|
||||
'tle_line2' => buildLine2($row, $row),
|
||||
];
|
||||
|
||||
@@ -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