HACKER Q&A
📣 eimrine

Is it possible to get a location using a camera looking at Moon/Sun?


Imagine we have any flagman smartphone but can not access GPS/GloNaS, GSM/CDMA and if we have an Internet connection we can't make any assumptions about IP.

We may turn a camera as needed, also we have compass, accelerometer, gyroscope and maybe an analog zoom.


  👤 floxy Accepted Answer ✓
I think you might enjoy the book "Longitude" by Dava Sobel

https://www.amazon.com/Longitude-Genius-Greatest-Scientific-...

https://en.wikipedia.org/wiki/Longitude_(book)

For a teaser on John Harrison's chronometer and celestial navigation:

https://wornandwound.com/history-of-chronometers-pt-1-origin...


👤 AlDante2
If you can measure the angle of the sun over the horizon at noon you can get both latitude and longitude. Longitude is the difference between local noon and Greenwich noon. The observed angle of the sun at noon is called its altitude. The angle of the sun above the equator is called its declination and can be calculated. Latitude is declination + (90 - altitude).

This calculation needs to be adjusted for hemisphere and high altitudes - see, e.g. here: https://astronavigationdemystified.com/latitude-from-the-mid...

Here is the calculation for the sun’s declination. I’m sure you can find more accurate formulae. https://sinovoltaics.com/learning-center/basics/declination-...


👤 timonoko
Two pictures 10 minutes apart of sun close to the horizon (and UTC Timecode) is all you need. Python Astropy gives also size of the sun (i.e. photo scale), so you have everything you need to reverse this function.

    def sun_angle(mon,day,hour,min,sec,lat,lon):
     import astropy.coordinates as coord
     from astropy.time import Time
     import astropy.units as u
     loc = coord.EarthLocation(lon=lon * u.deg, lat=lat * u.deg)
     times = f'2022-{mon}-{day}T{hour}:{min}:{sec}'
     now  = Time(times, format='isot', scale='utc')
     altaz = coord.AltAz(location=loc, obstime=now)
     sun = coord.get_sun(now).transform_to(altaz).alt
     return sun.degree

👤 verdverm
Reddit geolocated a flag based off a camera feed. They used the sun and contrails to locate it iirc

https://youtu.be/vw9zyxm860Q I think describes this event


👤 Someone
For historical methods, see https://en.wikipedia.org/wiki/History_of_longitude#Methods_o....

Given the presence of an internet connection, I think it’s easiest to query a time server at midday (detected by detecting the time when the sun is highest above the horizon/shadows are shortest) to get longitude.

(Latitude is relatively simple; one can, for example, use a sextant to measure the height of the pole star above the horizon)


👤 rapjr9
I proposed a research project a decade or more ago at a university to use a simple light sensor to build an ultracheap location device. It would use light intensity to figure out when sunrise and sunset were along with an internal clock. I have the details archived somewhere, but while it was super cheap it was not fast. It would take a day or several days to get a location approximation, and it could possibly be fooled by mountains or hills causing sunset or sunrise (or both) to occur later (although I think that as long as it had some exposure to outdoor light it would probably still work, since sunset behind a mountain is not the same as actual sunset). It needed a fair amount of storage to store some lookup tables. Even so the idea was it would be able to calculate approximate location anywhere in the world at low cost. The use case I imagined was package and equipment (cars, bikes, tractors, gear) tracking, in part for theft recovery. If the system had a radio it could use opportunistic connections to send its estimates occasionally (every few days perhaps) to a remote system. While it had accuracy limitations it might have been useful to get an approximate idea of where anything with a small tag attached to it was in the world. Once you had a rough idea of where it was, that narrows the search for whatever is missing. When you get close to it the radio could help refine the search (set out some sniffers and wait for the once every few days ping to try to triangulate it.) It didn't really fit with our research groups expertise though and we never pursued it. The opportunistic network connections could have also helped zero in on the location.

👤 akadruid1
Smartphones contain lots of useful components for celestial navigation such as a gyroscope to measure angles and multiple ways to establish the current time accurately. There are apps that can attempt this such as "CamSextant" but ironically, the big challenge is actually the camera which is wide angle and hard to use for precise observations.

There are a few projects which marry cheap zoom lenses with smartphones (e.g. https://www.instructables.com/ISextant-Project/) to overcome this.

You may also be interested in this app which compares GPS positioning with sextant altitude allowing you easily detect errors with either: http://reednavigation.com/GPSAntiSpoof/


👤 HarryHirsch
Sir Nevil Maskelyne would like his Longitude Prize: https://www.rmg.co.uk/stories/topics/longitude-found-nevil-m...

👤 muzani
I've figured out where people lived based on sunset times.

Sunset is a prayer time in Islam, so sunset times in most cities in the world is accurately calculated. Sunrise too. The window for a sunrise and sunset is about 5 min, which should give you decent accuracy.

You still need latitude though.


👤 perilunar
You don't even need the camera, just the clock.

The time of local solar noon will give you the longitude.

The altitude or the sun (you could use the gyroscope here, or just use a protractor) will allow you to calculate latitude.

The internet connection will allow you to find out how to calculate it.


👤 softical
I saw this tech at a conference a while back. There is a white paper on the site.

https://www.polarissensor.com/skypass/


👤 mytailorisrich
I suspect that with UTC time/date (less sure with local time), compass, and picture of Sun in sky it's possible to get a fairly good idea of area.