diff --git a/__tests__/sgp4.js b/__tests__/sgp4.js index b4df440..52c628e 100644 --- a/__tests__/sgp4.js +++ b/__tests__/sgp4.js @@ -324,7 +324,8 @@ describe("problematic TLES (geosync, decayed)", () => { tle: tleStr, startTimeMS: timestamp }); - expect(result.length).toEqual(6001); + // Time until it reaches the antemeridian + expect(result.length).toEqual(172809); }); test("getGroundTracks", async () => { diff --git a/src/sgp4.js b/src/sgp4.js index 79a89bd..eeedc1f 100644 --- a/src/sgp4.js +++ b/src/sgp4.js @@ -390,11 +390,13 @@ export async function getOrbitTrack({ stepMS = 1000, sleepMS = 0, jobChunkSize = 1000, - maxTimeMS = 6000000, + maxTimeMS, isLngLatFormat = true }) { const { tle: tleArr } = parseTLE(tle); + maxTimeMS ??= getAverageOrbitTimeMS(tleArr) * 1.5; + const startS = (startTimeMS / 1000).toFixed(); const cacheKey = `${tleArr[0]}-${startS}-${stepMS}-${isLngLatFormat}`; if (cachedOrbitTracks[cacheKey]) {