Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect timestamp parameter key for getGroundTracksSync #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/sgp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe("getGroundTracksSync", () => {
test("1", () => {
const coords = getGroundTracksSync({
tle: tleArr,
optionalTimeMS: 1501039265000
startTimeMS: 1501039265000
});
expect(coords.length).toBe(3);

Expand All @@ -271,7 +271,7 @@ describe("getGroundTracksSync", () => {
const timestamp = 1620583838732;
const result = await getGroundTracksSync({
tle: proxima2,
optionalTimeMS: timestamp
startTimeMS: timestamp
});
expect(result[0][0][0]).toBeCloseTo(-179.65354);
expect(result[0][0][1]).toBeCloseTo(84.57353);
Expand Down
6 changes: 3 additions & 3 deletions src/sgp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ export function getGroundTracks({
export function getGroundTracksSync({
tle,
stepMS = 1000,
optionalTimeMS = Date.now(), // TODO: change to startTimeMS for consistency
startTimeMS = Date.now(),
isLngLatFormat = true
}) {
const parsedTLE = parseTLE(tle);
Expand All @@ -629,7 +629,7 @@ export function getGroundTracksSync({
const orbitTimeMS = getAverageOrbitTimeMS(tleArr);
const curOrbitStartMS = getLastAntemeridianCrossingTimeMS(
parsedTLE,
optionalTimeMS
startTimeMS
);

const foundCrossing = curOrbitStartMS !== -1;
Expand All @@ -638,7 +638,7 @@ export function getGroundTracksSync({

const partialGroundTrack = getOrbitTrackSync({
tle: parsedTLE,
startTimeMS: optionalTimeMS,
startTimeMS: startTimeMS,
stepMS: _MS_IN_A_MINUTE,
maxTimeMS: _MS_IN_A_DAY / 4
});
Expand Down