Skip to content

Commit

Permalink
fix: 🐛 fix getGroundTracks stopping short of antemeridian (#44)
Browse files Browse the repository at this point in the history
fixes issue #43
  • Loading branch information
thkruz authored Oct 27, 2023
1 parent c0f9dd1 commit 31a9f54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion __tests__/sgp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
4 changes: 3 additions & 1 deletion src/sgp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down

0 comments on commit 31a9f54

Please sign in to comment.