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

How to predict satellite passes with satellite.js? #56

Closed
pkrasicki opened this issue Sep 10, 2019 · 4 comments
Closed

How to predict satellite passes with satellite.js? #56

pkrasicki opened this issue Sep 10, 2019 · 4 comments

Comments

@pkrasicki
Copy link

Hi, I really like this library! I was able to track satellite's position using the example from readme. Now I would like to know how to predict future satellite passes for a given location, but I don't even know where to start. Is there an example or some tutorial you could point me to?

@thkruz
Copy link
Collaborator

thkruz commented Sep 10, 2019

// Or you can use a JavaScript Date
var positionAndVelocity = satellite.propagate(satrec, new Date());

Create a Date variable passTime = new Date(year, month, day, hours, minutes, seconds, milliseconds);
Then use var positionAndVelocity = satellite.propagate(satrec, passTime); instead.

As for changing your location...

// Set the Observer at 122.03 West by 36.96 North, in RADIANS
var observerGd = {
longitude: satellite.degreesToRadians(-122.0308),
latitude: satellite.degreesToRadians(36.9613422),
height: 0.370
};

Just change those values to the location you want to use.

It's that simple! Let me know if you need anything clarified or have more questions.

@pkrasicki
Copy link
Author

Thanks, but in my case I don't know the date. I need to know when the satellite will be passing nearby my location. I want to know when I will be able to observe it from my position :).

Something like this site: https://spotthestation.nasa.gov/sightings/view.cfm?country=France&region=None&city=Paris. It gives you a list of dates when ISS will be visible from a given city.

@thkruz
Copy link
Collaborator

thkruz commented Sep 10, 2019

This is done through iteration. I don't have a code editor available and probably have a glaring error, but conceptually:

// Set Start Time
passTime = new Date(year, month, day, hours, minutes, seconds, milliseconds);
// Loop at 30 second intervals for 1 day
for (timeAdjust = 0; timeAdjust < 2880; timeAdjust++) {
    passTime = passTime + (timeAdjust * 30) // Add 30 seconds this loop
    positionAndVelocity = satellite.propagate(satrec, passTime);
     ...
     if (elevation > 10) {
           // Do stuff for visible passes like adding it to a table
      }
}

There are things you can do to reduce the time this loop takes, like skipping ahead in time after an object leaves field of view, but there is no way around guess-and-check.

@pkrasicki
Copy link
Author

Thank you! That's what I needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants