2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 13:18:15 +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

@@ -253,7 +253,7 @@ def entrancetags(request):
continue continue
if e.best_station(): if e.best_station():
continue continue
if e.findability != "S": # it says we do not have coordinates if e.findability != "S": # it says we do not have coordinates, but it might be lying. Or coordinates may be only in Spelix.
ents1623.append(e) ents1623.append(e)
ents1623.sort(key=entKey) ents1623.sort(key=entKey)

View File

@@ -147,6 +147,8 @@ def extract_gps(dict):
s = rational(sf) s = rational(sf)
return (d, m, s) return (d, m, s)
latitude = ""
longitude = ""
compass_points = ["N", "NE", "E", "SE", "S", "SW", "W", "NW", "N"] compass_points = ["N", "NE", "E", "SE", "S", "SW", "W", "NW", "N"]
if bearing := extract("GPSImgDirection"): if bearing := extract("GPSImgDirection"):
compass_lookup = round(bearing / 45) compass_lookup = round(bearing / 45)
@@ -210,16 +212,20 @@ def extract_gps(dict):
longitude = dms2dd(d, m, s, lonref) longitude = dms2dd(d, m, s, lonref)
print(f"{longitude=}") print(f"{longitude=}")
else: 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>' if latitude and longitude:
# 3 digits for longitude (0-359) or +/-(0-180), 2 for latitude +/-(0-90) # 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)? # 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(direction)
print(altitude) print(altitude)
print(timestamp_utc) print(timestamp_utc)
# location = dms2dd() # to do... # location = dms2dd() # to do...
print(location)
return f"{direction}<br />{location}<br />{altitude}</br />{timestamp_utc}<br />" 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 will catch photos uploaded directly from phones which otherwise never
get recorded properly in original format. 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. 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.
""" """
if photographer: if photographer:
photographer = photographer.strip().replace(" ","") photographer = photographer.strip().replace(" ","")