Getting lat/lon for a whole day.
See original GitHub issueHey, I was trying to generate a list containing the lat/lon of the ISS in every second (preferably millisecond) of the day, I tried to do this and ended up crashing my browser, is there any efficient way to do so without crashing my browser?
function predPoints(tle1, tle2){
  var dateTime = new Date();
  var i;
  for (i = 0; i < 86401; i++){
    var satrec = satellite.twoline2satrec(tle1, tle2);
    var positionAndVelocity = satellite.propagate(satrec, dateTime.setSeconds(dateTime.getSeconds() + i ));
    var positionEci = positionAndVelocity.position;
    var gmst = satellite.gstime( dateTime.setSeconds(dateTime.getSeconds() + i ));
    var positionGd = satellite.eciToGeodetic(positionEci, gmst);
    var longitude = positionGd.longitude,
        latitude  = positionGd.latitude;
    var longitudeStr = satellite.degreesLong(longitude),
        latitudeStr  = satellite.degreesLat(latitude);
    position = [longitudeStr, latitude]
    console.log(position);
  }
Issue Analytics
- State:
 - Created 3 years ago
 - Comments:7 (4 by maintainers)
 
Top Results From Across the Web
Get Lat Long from Address Convert Address to Coordinates
A handy tool to get lat long from address, helps you to convert address to coordinates (latitude longitude) on map, also calculates the...
Read more >How to Get Latitude and Longitude from Google Maps - wikiHow
1. Download and open Google Maps. Go to the App Store (iOS), search "Google Maps", and tap the Get/Install button next to the...
Read more >How to get lat-long values of all areas in a city - Stack Overflow
I am interested in getting the latitude, longitude values of all areas in a city. Currently i am using this google maps api....
Read more >Using Google Maps to get LAT/LONG - YouTube
Using Google Maps to get LAT / LONG ... How to use Google Maps to return the Latitude and Longtitude of a location....
Read more >NOAA Improved Sunrise/Sunset Calculation
If you want to input latitude, longitude or time zone manually, be sure to select "Enter Lat/Long -->" from the City pulldown box,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It sounds like there’s a problem in your code that is causing an infinite loop. Double check the stop condition and make sure it is indeed exiting. I’m using a similar looping strategy with own library and it works fine and is very fast.
One second intervals will get you a pretty nice ground track, except at extreme polar latitudes on Mercator projection maps, which have more map distortion and need <1s intervals for a slightly smoother-looking line at those latitudes.
Thank you so much, removing the vars and declaring them outside the function made it work, Also thanks for the advice I will try to use milliseconds instead of seconds and see how they compare in accuracy!