2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-19 05:57:20 +00:00

fix latitude bugs

This commit is contained in:
2025-03-02 23:30:40 +00:00
parent 3bdf73ccad
commit ab8d527163
2 changed files with 13 additions and 10 deletions

View File

@@ -147,6 +147,8 @@ def extract_gps(dict):
s = rational(sf)
return (d, m, s)
latitude = ""
longitude = ""
compass_points = ["N", "NE", "E", "SE", "S", "SW", "W", "NW", "N"]
if bearing := extract("GPSImgDirection"):
compass_lookup = round(bearing / 45)
@@ -210,16 +212,20 @@ def extract_gps(dict):
longitude = dms2dd(d, m, s, lonref)
print(f"{longitude=}")
else:
print("failed to find latitude")
print("failed to find longitude")
location = f'<a href="https://www.openstreetmap.org/?mlat={latitude}&mlon={longitude}">{latitude:09.6f} {latref}, {longitude:010.6f} {lonref}</a>'
# 3 digits for longitude (0-359) or +/-(0-180), 2 for latitude +/-(0-90)
# we might want to rectify longitude to be always +(0-359)?
if latitude and longitude:
# 3 digits for longitude (0-359) or +/-(0-180), 2 for latitude +/-(0-90)
# we might want to rectify longitude to be always +(0-359) not +/- 180 ?
location = f'<a href="https://www.openstreetmap.org/?mlat={latitude}&mlon={longitude}">{latitude:09.6f} {latref}, {longitude:010.6f} {lonref}</a>'
print(location)
else:
location = ""
print(direction)
print(altitude)
print(timestamp_utc)
# location = dms2dd() # to do...
print(location)
return f"{direction}<br />{location}<br />{altitude}</br />{timestamp_utc}<br />"
@@ -434,10 +440,7 @@ def save_original_in_expofiles(f, year, photographer, host, handbook_directory,
will catch photos uploaded directly from phones which otherwise never
get recorded properly in original format.
Django does small files <2.5 MB in memory, which is a pain, as we can't simply move them.
to do: also store a *.url file with the image file saying where it is used in the handbook.
Django does small files <2.5 MB in memory, which is a pain, as we can't simply move them.
"""
if photographer:
photographer = photographer.strip().replace(" ","")