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

Need a 'What is above me now' view #3

Open
jensenbox opened this issue Jul 6, 2015 · 6 comments
Open

Need a 'What is above me now' view #3

jensenbox opened this issue Jul 6, 2015 · 6 comments

Comments

@jensenbox
Copy link

Use the geolocation of the browser to assist - either by IP or just the standard HTML5 sensor.

@thkruz
Copy link

thkruz commented Apr 26, 2017

The satcruncher webworker has the framework for az, el, and range calculations from a lat long. You could modify the satcruncher to have a binary "inview" variable and then change the colorscheme to highlight things that are "inview".

@louiselessel
Copy link

Hi @jensenbox - were you able to solve this? I need this view as well.
Specifically I need a "What are the closest 100 satellites to this latitude, longitude (40.730610, -73.935242) on earth" - view,
or a "What are the satellites within a radius of 200 km, to this latitude, longitude (40.730610, -73.935242) on earth"

I looked at @thkruz suggestion, but I cannot see how I would write that in the satcruncher unfortunately.

@thkruz
Copy link

thkruz commented May 21, 2019

Let me be more detailed on my earlier response:

Below the declaration for satPos, add the following and adjust to your needs:
var defaultGd = { latitude: 41.015, longitude: -71.125, height: 0.54 };

Below var x,y,z,vx,vy,vz,alt; add:
var azimuth, elevation, rangeSat;

Add the following code:
positionEcf = satellite.eciToEcf(pv.position, gmst);
lookangles = satellite.ecfToLookAngles(defaultGd, positionEcf);
azimuth = lookangles.azimuth; (You might not need this for a telescope)
elevation = lookangles.elevation;
rangeSat = lookangles.rangeSat;

That will allow you to calculate AER for each satellite relative to your lat/long. From there you could add an if statement along the lines of:

if (elevation >= 0 && rangeSat < 200) then to filter satellites currently closer than 200km and pass them back to main.js

NOTE: You will need to create a new array both in sat.js and sat-cruncher.js to pass back and forth. Then you would need to create a new if statement in color-scheme.js to change the object's color.

Let me know if you hit any more road blocks. I forked this project at https://github.com/thkruz/keeptrack.space/ and have the code for this included if you need a reference point (copying and pasting it will almost surely fail). There is simply no way around these changes for what you are asking for. If you don't want to/can't then it might be best to look for another library to do the calculations on-demand instead of in the webworker.

Best of luck.

PS. Geolocation requires https in most modern browsers.

@louiselessel
Copy link

Thank you @thkruz !

This worked like a charm, just one question then: how would I access the satellites id or type from here?
I am doing:

if (elevation >= 0 && rangeSat < 2000) {
arrayOfSats1.push(satellite);
}
However that is all of the data, and I can't seem to find the id from in there? Is it another value that I should be pushing here?

thank you so much!

@thkruz
Copy link

thkruz commented May 31, 2019

@louiselessel you can add

extra.SCC_NUM = pad0(satData[i].TLE1.substr(2, 5).trim(), 5)

function pad0 (str, max) {
    return str.length < max ? pad0('0' + str, max) : str;
};

to satcruncher around line 19 (put the function towards the bottom if you want)..

Now you can use the SCC_NUM property to filter inside satcruncher AND it will get passed back to satSet so that you can use it inside the main program too. Something like

if (arrayOfSats1[i].SCC_NUM == '25544')

It is probably more optimal to push "i" or satCache[i].SCC_NUM instead of the whole satCache[i] object since the satCache exists in satSet.js as well with the same id and SCC_NUM properties. The postMessage call can be resource intensive on slower machines.

I pad 0s and use strings for consistency sake when dealing with other external databases that may or may not call 00005 instead of 5.

@louiselessel
Copy link

Thank you @thkruz.

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

3 participants