-
Notifications
You must be signed in to change notification settings - Fork 121
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 calculate terrestial coordinates from celestial coordinates? #242
Comments
Long version Start at the NAIF/SPICE required reading for Rotations: It will take a while, but once you understand it
Short version There are four 3-D frames (orientations): image (camera); local (latitude and longitude); Earth Body-Fixed (rotation at time); target (RA, DEC). You have the rotations (connection) between pairs of three of the four frames, and can calculate the fourth, local, by difference. Convert everything to rotation matrices, which matrices convert vectors from one frame to another frame:
We will solve for the unknown rotation, Mebf2local = [Earth-Body-Fixed]-to-[Latitude-Longitude] Then, since
we can solve for Mebf2local like this
where the [T] suffix means transpose. With the Python interface to the NAIF/SPICE toolkit, that solution it's one line of code. With another few lines to get from the known angles to the known matrices, and then one or two to get from the solved-for matrix to latitude and longitude, there will be more lines parsing the inputs and writing the output than you will need to solve the problem. I think you can get away without knowing Twist (Direction of J2000 North, clockwise from up, in the image). Then convert the solved-for Mebf2local back to the local angles of latitude and longitude. is azimuth something like "degrees clockwise from north?" |
Thanks for the tip. Yes, azimuth is measured clockwise from North (0 degrees) and elevation is measured as degrees above the horizon. |
Not directly in Pyephem, no, I don't think so. That page does say, if you have RA/DEC and Lat/Lon, that you can calculate alt/az. So you could probably run an algorithm (binary search?) to solve for Lat/Lon, although it might get messy near the PM. Also, since the RA/DEC frame is essentially co-polar with the Lat/Lon frame at any epoch, Pyephem might allow you to calculate at RA/DEC from the alt/az at a random Lat/Lon (e.g. 0/0) of the observation epoch, then you could adjust the Lat by the difference between that calculated DEC and the known observation DEC, then calculate a second RA/DEC from the alt/az at that adjusted Lat and the same Lon (0), then adjust the Lon by the difference between the second calculated RA and the know observation RA. For higher accuracy that process could probably be repeated by successive substitution or even Newton's method. |
I have a picture of the night sky and the matching RA/Dec coordinates of the center. I also have the azimuth and elevation the camera was pointed at, and the time. How can I use this information to calculate the latitude and longitude on Earth where the picture was taken from? I've tried working through some of the examples on the Coordinate Transformations page but I can't figure out how to apply that to my problem. Would appreciate any pointers.
The text was updated successfully, but these errors were encountered: