<p>The equation that relates the altitude, latitude and longitude is as follows:
<span class="math-container">$$\sin{a}=\cos{h}\cos{\delta}\cos{\phi}+\sin{\delta}\sin{\phi}$$</span>
where</p>
<ul>
<li>a is the altitude</li>
<li>h is the hour angle which includes the longitude of the observer (and the right ascension of the Sun which is known from the date and time).</li>
<li><span class="math-container">$\delta$</span> is the declination of the Sun (which is known from the date and time).</li>
<li><span class="math-container">$\phi$</span> is the latitude of the observer.</li>
</ul>
<p>This gives one equation with two unknowns. From measuring the altitude at two different times, you have two equations and two unknowns which can be solved for latitude and longitude. (Solve for hour angle and latitude first.)</p>
<p>There may not be a direction solution to the two equations since it involves trig functions. The solution may require an iterative approach which is easier to do since you have a computer.</p>
<p>The solution may be easier if you measure the azimuth of the Sun also; or at least knowing the azimuth (az) will give you a first approximation of the longitude.
<span class="math-container">$$\tan(az) = \frac{\sin(h)}{\cos(h)\sin(\phi)-\tan(\delta)\cos(\phi)}$$</span></p>
<p>Edit: I should point out that the time needs to be Universal Time in order to determine the latitude. The time cannot be the local time. For example, if it is 10 am local time and you are at 30° latitude, the Sun will be in the same basic position regardless of your latitude. The exception is if you know the &quot;standard latitude&quot; for your time zone (0°, 15°, 30°, ...). Then the equations can be used with the local time to find the offset from the standard longitude.</p>
<p>Greg Miller also pointed out in comments that two observations and the altitude equation are not enough to determine the latitude and longitude uniquely. For a given altitude from observation 1, there is a ring of latitude,longitude points that are centered on the subsolar point. Observation 2 gives a different ring centered about the new subsolar point. The two two rings intersect at 2 points. To determine which of the 2 points of intersection is correct, a third observation.</p>

CC BY-SA 4.0
2022-03-17T17:25:20.017Z
At least three points are required, while a solution will exist with two points, there will usually be more than one solution.  Eg. $ \cos \phi = \cos -\phi $.  If you have the azimuth, you only need one point, as there is only one place on earth an object will have a given alt/az.
Greg Miller
CC BY-SA 4.0
2022-03-18T16:22:46.367Z
Thanks, this is helpful!  Re: nonuniqueness, I suspect one solution or the other may be easy to rule out based on physical plausibility, at least in temperature latitudes.  The "computer" in my case is a microcontroller, but we are not terribly energy-constrained due to abundant sunlight, so it would be fun to develop an iterative solver to run on the platform.  Telemetry is far more constrained, so it is far better to transmit estimated coordinates than to transmit a bunch of solar observations.
mark03
CC BY-SA 4.0
2022-03-18T16:25:44.450Z
Also, because the orientation of the platform is unknown (although we believe/hope that it will be horizontal w.r.t. the earth's surface---at least on a time-averaged basis) we can't measure the solar azimuth.  Maybe if we added a magnetometer...
mark03
CC BY-SA 4.0
2022-03-18T22:37:15.443Z
A magnetometer won't help much.  Since magnetic North and true North are very different, you have to know your magnetic declination offset to produce an accurate measurement.  And you need to know your location to compute that.
Greg Miller
CC BY-SA 4.0
2022-03-19T05:21:47.537Z
True.  I wonder if you could iterate back and forth to convergence.  But we're not planning to try this.
mark03
CC BY-SA 4.0
2022-03-17T13:32:06.983Z
2022-03-18T17:27:03.117Z
2022-03-18T17:27:03.117Z
JohnHoltz
<p>The &quot;forward&quot; problem (given time and lat/lon, find solar position angles) is well documented, e.g. <a href="https://stackoverflow.com/questions/8708048/position-of-the-sun-given-time-of-day-latitude-and-longitude">here</a>.  I am trying to figure out the &quot;inverse&quot; problem: given time and [a sequence of] solar elevation measurements, find lat/lon.</p>
<p>There are some obvious special cases; for example, if I record the exact times of sunrise and sunset, then my location lies at an intersection of solar-terminator great circles.</p>
<p>More generally, at any given time during the day, if the solar elevation is phi, than my location must lie somewhere on the [non-great] circle of constant phi solar elevation.  It should be possible to calculate this continuously and, if I am moving, come up with a quasi-real-time position estimate.</p>
<p>Celestial navigation is the right body of knowledge, but all of the references I've found assume labor-intensive measurement (i.e. sextants) and simple hand calculations.  I can sense the input data autonomously and continuously, and I have a computer available.</p>

CC BY-SA 4.0
2022-03-17T02:33:51.787Z
One thing you didn't mention, but which is an absolute requirement, is an ephemeris to tell you the position of the Sun (relative to the center of the Earth) for the given time.  The problem then simplifies down to a three point celestial fix.  For the time of one measurement, use the ephemeris to compute the Sun's Geographic Position (GP) [the GP is the lat/lon on Earth where the Sun is directly overhead].  If your sun elevation measurement for that time is 90deg, you were lucky, your position is equal to the Sun's GP.
Greg Miller
CC BY-SA 4.0
2022-03-17T02:40:03.847Z
But, odds are, it won't be 90deg.  If it were 80deg, then you know you're exactly 10 degrees away from the Sun's GP.  You can plot this circle of radius 10 on a globe.  Repeating this for another of your measurements, you will plot a different circle on the globe which will intersect the other at two points.  Repeating the process for a third point, you'll have three circles that intersect at one point, and that's your lat/lon.  This process isn't practical in reality, as it requires you to stay in one position for a long period to get measurements far enough apart to produce good accuracy.
Greg Miller
CC BY-SA 4.0
2022-03-17T16:48:57.757Z
@Greg Miller you actually don't have to stay in one place. You can get morning and afternoon LOPs from the intercept method (if you have a rough idea of your location). To find your position (at the time of the afternoon observation) move the morning LOP by your dead-reckoned change in position. Accuracy would be degraded by the inaccuracy in dead-reckoning.
stretch
CC BY-SA 4.0
2022-03-17T17:24:51.493Z
How are you continuously and autonomously sensing while moving? How much accuracy do you need?
stretch
CC BY-SA 4.0
2022-03-18T16:16:05.813Z
@stretch, the platform is a proposed high-altitude "pico-balloon" without GPS.  With a pair of vertical solar cells facing the horizon in different directions, and a horizontal solar cell facing the zenith, we believe we can obtain a continuous, albeit noisy, record of solar altitude.  This assumes the payload is spinning about the vertical axis---in fact, it depends on it---but that vertical axis is largely stable (not too much turbulence).  We'll see!
mark03
<ephemeris><sunrise><navigation><sunset>
How can I calculate my position (lat/lon) given a sequence of solar-elevation measurements at known times?
mark03
# How can I calculate my position (lat/lon) given a sequence of solar-elevation measurements at known times?

(Asked by: username_0 on 2022-03-16)

The "forward" problem (given time and lat/lon, find solar position angles) is well documented, e.g. [here](https://stackoverflow.com/questions/8708048/position-of-the-sun-given-time-of-day-latitude-and-longitude). I am trying to figure out the "inverse" problem: given time and [a sequence of] solar elevation measurements, find lat/lon.

There are some obvious special cases; for example, if I record the exact times of sunrise and sunset, then my location lies at an intersection of solar-terminator great circles.

More generally, at any given time during the day, if the solar elevation is phi, than my location must lie somewhere on the [non-great] circle of constant phi solar elevation. It should be possible to calculate this continuously and, if I am moving, come up with a quasi-real-time position estimate.

Celestial navigation is the right body of knowledge, but all of the references I've found assume labor-intensive measurement (i.e. sextants) and simple hand calculations. I can sense the input data autonomously and continuously, and I have a computer available.

**Tags:** ephemeris, sunrise, navigation, sunset

> **Comments:**
> **username_1**: One thing you didn't mention, but which is an absolute requirement, is an ephemeris to tell you the position of the Sun (relative to the center of the Earth) for the given time.  The problem then simplifies down to a three point celestial fix.  For the time of one measurement, use the ephemeris to compute the Sun's Geographic Position (GP) [the GP is the lat/lon on Earth where the Sun is directly overhead].  If your sun elevation measurement for that time is 90deg, you were lucky, your position is equal to the Sun's GP.  
> **username_1**: But, odds are, it won't be 90deg.  If it were 80deg, then you know you're exactly 10 degrees away from the Sun's GP.  You can plot this circle of radius 10 on a globe.  Repeating this for another of your measurements, you will plot a different circle on the globe which will intersect the other at two points.  Repeating the process for a third point, you'll have three circles that intersect at one point, and that's your lat/lon.  This process isn't practical in reality, as it requires you to stay in one position for a long period to get measurements far enough apart to produce good accuracy.  
> **username_2**: @username_1 you actually don't have to stay in one place. You can get morning and afternoon LOPs from the intercept method (if you have a rough idea of your location). To find your position (at the time of the afternoon observation) move the morning LOP by your dead-reckoned change in position. Accuracy would be degraded by the inaccuracy in dead-reckoning.  
> **username_2**: How are you continuously and autonomously sensing while moving? How much accuracy do you need?  
> **username_0**: @username_2, the platform is a proposed high-altitude "pico-balloon" without GPS.  With a pair of vertical solar cells facing the horizon in different directions, and a horizontal solar cell facing the zenith, we believe we can obtain a continuous, albeit noisy, record of solar altitude.  This assumes the payload is spinning about the vertical axis---in fact, it depends on it---but that vertical axis is largely stable (not too much turbulence).  We'll see!  

---

## 1 answers

### Answer by username_3 on 2022-03-17. Score: 1 | Accepted answer

The equation that relates the altitude, latitude and longitude is as follows:
$$\sin{a}=\cos{h}\cos{\delta}\cos{\phi}+\sin{\delta}\sin{\phi}$$
where

* a is the altitude
* h is the hour angle which includes the longitude of the observer (and the right ascension of the Sun which is known from the date and time).
* $\delta$ is the declination of the Sun (which is known from the date and time).
* $\phi$ is the latitude of the observer.

This gives one equation with two unknowns. From measuring the altitude at two different times, you have two equations and two unknowns which can be solved for latitude and longitude. (Solve for hour angle and latitude first.)

There may not be a direction solution to the two equations since it involves trig functions. The solution may require an iterative approach which is easier to do since you have a computer.

The solution may be easier if you measure the azimuth of the Sun also; or at least knowing the azimuth (az) will give you a first approximation of the longitude.
$$\tan(az) = \frac{\sin(h)}{\cos(h)\sin(\phi)-\tan(\delta)\cos(\phi)}$$

Edit: I should point out that the time needs to be Universal Time in order to determine the latitude. The time cannot be the local time. For example, if it is 10 am local time and you are at 30° latitude, the Sun will be in the same basic position regardless of your latitude. The exception is if you know the "standard latitude" for your time zone (0°, 15°, 30°, ...). Then the equations can be used with the local time to find the offset from the standard longitude.

username_1 also pointed out in comments that two observations and the altitude equation are not enough to determine the latitude and longitude uniquely. For a given altitude from observation 1, there is a ring of latitude,longitude points that are centered on the subsolar point. Observation 2 gives a different ring centered about the new subsolar point. The two two rings intersect at 2 points. To determine which of the 2 points of intersection is correct, a third observation.

> **Comments:**
> **username_1**: At least three points are required, while a solution will exist with two points, there will usually be more than one solution.  Eg. $ \cos \phi = \cos -\phi $.  If you have the azimuth, you only need one point, as there is only one place on earth an object will have a given alt/az.  
> **username_0**: Thanks, this is helpful!  Re: nonuniqueness, I suspect one solution or the other may be easy to rule out based on physical plausibility, at least in temperature latitudes.  The "computer" in my case is a microcontroller, but we are not terribly energy-constrained due to abundant sunlight, so it would be fun to develop an iterative solver to run on the platform.  Telemetry is far more constrained, so it is far better to transmit estimated coordinates than to transmit a bunch of solar observations.  
> **username_0**: Also, because the orientation of the platform is unknown (although we believe/hope that it will be horizontal w.r.t. the earth's surface---at least on a time-averaged basis) we can't measure the solar azimuth.  Maybe if we added a magnetometer...  
> **username_1**: A magnetometer won't help much.  Since magnetic North and true North are very different, you have to know your magnetic declination offset to produce an accurate measurement.  And you need to know your location to compute that.  
> **username_0**: True.  I wonder if you could iterate back and forth to convergence.  But we're not planning to try this.  

---

