diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/views/caves.py | 2 | ||||
-rw-r--r-- | core/views/editor_helpers.py | 21 |
2 files changed, 13 insertions, 10 deletions
diff --git a/core/views/caves.py b/core/views/caves.py index cec613b..66a4943 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -253,7 +253,7 @@ def entrancetags(request): continue if e.best_station(): 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.sort(key=entKey) diff --git a/core/views/editor_helpers.py b/core/views/editor_helpers.py index 0b0d454..1b4dcf8 100644 --- a/core/views/editor_helpers.py +++ b/core/views/editor_helpers.py @@ -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(" ","") |