Where on Earth am I ?

What on Earth Does ALL this mean?

Navigate using known locations of celestial objects by the planeman


Sel Object Dist (lyr) Dec/Lat Lon RA
Select Stars 1 Select Stars 2 Select Planets

Manual Time Selection
yr mth day hr min sec Sel
UTC / / : :
input
object
declination deg     min sec
right ascension hr min sec
altitude deg
azimuth deg
output
Zone
Observer
time MST  
LMST
latitude     deg     min    
longitude     deg min


Contents

  1. About
  2. The source code
  3. Discussion

1. About Use Calculator Now

This Java Script calculator converts celestial coordinates of right ascension (RA) declination (DEC) given altitude (ALT) and azimuth (AZ) and the computer calculates latitude (LAT) and longitude (LON). To operate the calculator, enter these values. Press the LAT/LON button to obtain these LAT and LON values based on the current time on your computer. Note when an object is at its zenith, which is not usually directly overhead, then the local sidereal time equals the RA of the object. It will be overhead if the observer's LAT equals the DEC of the object. You can also put another (UTC) time in. Your position will be calculated, north and east degrees are positive integers; whereas south and west degrees are negative integers. On invalid entries, a popup window will display an error message. There can also be ambiguous answers where a choice is given.

Alternatively you can press the ALT/AZ button to obtain the ALT and AZ when the LAT, LON, RA and DEC of a celestial object are known. Press the Run button to generate updates at one-second intervals. The Halt button stops automatic updating. The Test button inserts the default test case to show how the calculator works. Note that the left table shows Latitude/Declination and longitude of the horizon coordinates of the zenith points of the celestial objects. To get the local mean sidereal time, LMST, of these objects select that object and set altitude to 90 deg in the right table.

The Celestial Sphere Observer Observer in the Celestial Sphere
The Celestial Sphere Observer Observer in the Celestial Sphere

Return to Contents


2. The source code Use Calculator Now

The Java Script source code for this program can be viewed by using the View|Source command of your web browser.

You may use or modify this source code in any way you find useful, provided that you agree that the author has no warranty, obligations or liability. You must determine the suitability of this source code for your use.

Return to Contents


3. Discussion Use Calculator Now

Equatorial coordinates

By extending the lines of latitude and longitude outward from the Earth and onto the inside of the celestial sphere we get the equatorial coordinate system. The coordinates of stars, planets, and other celestial objects corresponding to latitude and longitude are declination (DEC) and right ascension (RA).

The declination of an object is its angle in degrees, minutes, and seconds of arc above or below the celestial equator. The right ascension is the angle between an object and the location of the vernal equinox (First Point in Aries) measured eastward along the celestial equator in hours, minutes, and seconds of sidereal time. Since the location of the vernal equinox changes due to the precession of the Earth's axis of rotation, coordinates must be given with reference to a date or epoch.

Right ascension is given in time units. One hour corresponds to 1/24 of a circle, or 15° of arc. As the Earth rotates, the sky moves to the West by about 1 hour of right ascension during each hour of clock time or exactly one hour of sidereal time. The Earth makes one full revolution in about 23 hours and 56 minutes of clock time or 24 hours of sidereal time. Local sidereal time corresponds to the right ascension of the zenith, the point in the sky directly overhead.

For example, the coordinates of the star Regulus (Leo a) for epoch J2000 are:

RA:   10h 08m 22.3s
DEC: +11° 58' 02"

When the local sidereal time is 10h 08m 22.3s, it would be on the local meridian.

Horizon coordinates: azimuth and altitude

This is a local coordinate system to use for locating objects in the night sky as seen from a point on the Earth's surface. Azimuth is the angle of a celestial object around the sky from north. It is measure along the horizon in from North 0° through East 90°, South 180°, West 270° and back to North. Altitude is the complement of the zenith angle, which is the angle from the local meridian to the hour circle of object being observed. An object directly overhead would have an altitude of 90°. An object with a calculated altitude of 0° may not appear exactly on the horizon due to the refraction of light through the atmosphere. Generally, refraction makes objects near the horizon appear higher than their computed altitude.

Coordinate transformation

Given the azimuth (AZ), altitude (ALT), right ascension (RA) and declination (DEC) of a known object in the sky and using the date, universal time (UT) the latitude (LAT) and longitude (LON) of the observing site can be determined. All coordinates are expressed in degrees in the range -180° to 180°.

Local Mean Sidereal Time

The mean sidereal time (MST) is calculated from a polynomial function of UT since epoch J2000. This formula gives MST, the sidereal time at the Greenwich meridian (at longitude 0°) in degrees. To get local mean sidereal time (LMST), add longitude if East or subtract longitude if West.

MST  = f(UTC)
LMST = MST - RA      for the celestial object and
LMST = MST + lon     for the observer

Hour Angle

The hour angle (HA) is the angle between an observer's meridian projected onto the celestial sphere and the right ascension of a celestial body. It is used in coordinate conversion.

HA = LMSTRA

Conversion of HA, RA and DEC into ALT and AZ

This gives the computed horizon coordinates without correction for atmospheric refraction.

sin(ALT) = sin(DEC) sin(LAT) + cos(DEC) cos(LAT) cos(HA)

cos(A)    =  sin(DEC) − sin(ALT) sin(LAT)
cos(ALT) cos(LAT)

If sin(HA) is negative, then

AZ = A,

otherwise

AZ = 360 − A

Conversion of HA, ALT and AZ and DEC into LAT and LON

This gives the computed latitude and longitude without correction for atmospheric refraction.

  Given a spherical triangle{A,a,b}:  // Two sides, non-included angle
   A = Az, a = 90 - DEC
   b = 90 - ALT, B = ha
   c = LAT
   x = sin(A)*sin(b)/sin(a)
   if (x=1) {
     B = pi/2    // One spherical triangle exists
   } else if (x < 1) {
     B = asin(x) and pi-asin(x) // Two triangles exist
   } else{
     // No triangles exist
   }
   
   Up to 2 possible latitudes exist where

    if ((a - b)*(A-B)>0){
       ans1 = true
    }
    if ((a - b)*(A-B1)>0){
       ans2 = true
    }
 
    AP = (A+B)/2;
    AM = (A-B)/2;
    AP1 = (A+B1)/2;
    AM1 = (A-B1)/2;
    aP = (a+b)/2;
    aM = (a-b)/2;
 
    lat1 = plusminus90(2*atan(tan(aP)*cos(AP)/cos(AM)));
    lat2 = plusminus90(2*atan(tan(aP)*cos(AP1)/cos(AM1)));

    if(ans1)
       lat = lat1;
    if(ans2){
       lat = lat2;
       ha = sign(ha)*B1
    }

    if(!(ans1 || ans2)){
          window.alert("Invalid solution")
          lat = "none"
    }else if(ans1 && ans2){
		answer = confirm("Two possible solutions :
		(1) LAT1 = lat1  
			ha1 =  sign(ha) * B
		---- OR -----
		(2) LAT2 = lat2 
			ha2 = " + (sign(ha) * B1*100)/100)
		if (answer){
			lat = lat1;
			ans1 = true
			ans2 = false
		}else{
			lat = lat2;
			ans2 = true
			ans1 = false
		}
	}

   lon = -(ha + lmst)
 

Return to Contents

I would love to hear from you, if you have any comments

email Home Page


About the Author

Last modified on 24 Mar 2021

Copyright © 2006 Calculations based on

Stephen R. Schmitt site

Ed Wlliams site