question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting lat/lon for a whole day.

See original GitHub issue

Hey, 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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
davidcalhouncommented, Dec 31, 2020

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.

0reactions
JaniniRamicommented, Dec 31, 2020

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found