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

units of longitude in APIs #11

Open
yxiao1996 opened this issue Dec 28, 2021 · 2 comments
Open

units of longitude in APIs #11

yxiao1996 opened this issue Dec 28, 2021 · 2 comments

Comments

@yxiao1996
Copy link

Hello,

Thanks for the amazing library! I'm curious what's the unit for the longitude field in the API signatures.

The document mentions the following:

qth = 3 element array [latitude (degrees), longitude (degrees), altitude (km)]

However, I'm not sure should the longitude field is east longitude or west longitude. Upon my experiment, it looks like east longitude for me. Could you please help me confirm this? Also, could you please add this to the documentation?

Thanks and happy holiday,
Yu

@thkruz
Copy link

thkruz commented Dec 28, 2021

It is relying on the eciToGeodetic function in satellite.js which is bound to +/- pi (https://github.com/shashwatak/satellite-js/blob/1e6c4f0d14de5abab0d52b91a27b70028a0a0221/src/transforms.js)

let longitude = Math.atan2(eci.y, eci.x) - gmst;
  while (longitude < -pi) {
    longitude += twoPi;
  }
  while (longitude > pi) {
    longitude -= twoPi;
  }

If you look at (https://github.com/nsat/jspredict/blob/aef0b170ca46ccfb61572219c11f917ca48fa800/jspredict.js) you can see that there is a second attempt to bind it to +/- 180 degrees implying the author expected E and W

  _boundLongitude: function(longitude) {
      while (longitude < -180) {
        longitude += 360;
      }
      while (longitude > 180) {
        longitude -= 360;
      }
      return longitude
    }

@yxiao1996
Copy link
Author

Hi Theodore,

Thanks for replying! Apology for my terrible geography, but my question is actually quite simple, let me use an example. I'm trying to predict pass overs of a satellite over Hong Kong, and I'm verifying the output of jspredict using https://www.amsat.org/track/.

In this web tool I got to choose whether the longitude is based on East or West. For Hong Kong, I will put in 114 degree and East. On the other hand, I don't get a choice between East and West in jspredict's API, so I'm wondering what's the default.

Thanks,
Yu

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