News for hackers. Stuff that matters.
Re:Ask HN: Is it possible to get a location using a camera l... by timonoko on Tuesday July 05, 2022 @07:39PM (#31995088)
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
Re:Ask HN: Is it possible to get a location using a camera l... by timonoko on Tuesday July 05, 2022 @07:53PM (#31995182)
Forgot the bloody atmospheric distortion. But no worries, Astropy has estimate for that too, know as "parallax correction".
Re:Ask HN: Is it possible to get a location using a camera l... by timonoko on Wednesday July 06, 2022 @02:38AM (#31997537)
My Bad. "Parallax Correction" was for the camera's altitude (or photographers height). The atmospheric correction was something else.
Re:Ask HN: Is it possible to get a location using a camera l... by timonoko on Wednesday July 06, 2022 @03:11AM (#31997753)
BTW. In urban environment there are plenty of horizontal lines pointing to the vanishing point. Thus it is totally possible to make a camera app, which calculates your position from the sun alone. This might make total sense in Urban Warfare, when the enemy has blocked GPS signals.