2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-02-18 05:00:13 +00:00

ported radosts SRTM altitude tool

This commit is contained in:
Philip Sargent 2023-10-27 22:13:14 +03:00
parent 7672de2dd1
commit 788de853dc
4 changed files with 28565 additions and 5 deletions

View File

@ -443,6 +443,11 @@ class Entrance(TroggleModel):
else: else:
return None return None
def best_alt(self):
return self.best_station_object().z
def best_srtm_alt(self):
return self.best_station_object().srtm_alt
def GetCaveLookup(): def GetCaveLookup():
"""A very relaxed way of finding probably the right cave given almost any string which might serve to identify it """A very relaxed way of finding probably the right cave given almost any string which might serve to identify it

View File

@ -1,3 +1,4 @@
import math
import os import os
import re import re
from urllib.parse import urljoin from urllib.parse import urljoin
@ -6,7 +7,7 @@ from pathlib import Path
from django.conf import settings from django.conf import settings
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from troggle.core.utils import height_from_utm
# from troggle.core.models.troggle import DataIssue # circular import. Hmm # from troggle.core.models.troggle import DataIssue # circular import. Hmm
@ -72,7 +73,23 @@ class SurvexStation(models.Model):
return utmToLatLng(33, self.x, self.y, northernHemisphere=True)[0] return utmToLatLng(33, self.x, self.y, northernHemisphere=True)[0]
def long(self): def long(self):
return utmToLatLng(33, self.x, self.y, northernHemisphere=True)[1] return utmToLatLng(33, self.x, self.y, northernHemisphere=True)[1]
import math
def srtm_alt(self):
return height_from_utm(self.x, self.y) # height, distance from reference point
def srtm_diff(self):
alt, ref = height_from_utm(self.x, self.y) # height, distance from reference point
diff = alt - self.z
if diff >= 0:
diff_str = f"<span style='color:blue'>+{diff:.0f}</span>"
else:
diff_str = f"<span style='color:red'>{diff:.0f}</span>"
return diff_str, ref
def utmToLatLng(zone, easting, northing, northernHemisphere=True): # move this to utils.py ? def utmToLatLng(zone, easting, northing, northernHemisphere=True): # move this to utils.py ?
if not northernHemisphere: if not northernHemisphere:

File diff suppressed because it is too large Load Diff

View File

@ -179,7 +179,8 @@
<dt>Location</dt><dd><a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.lat_wgs84|floatformat:7}}&mlon={{ent.entrance.long_wgs84|floatformat:7}}">WGS84 Lat.: {{ ent.entrance.lat_wgs84|floatformat:7 }} N, Long.:{{ ent.entrance.long_wgs84|floatformat:7 }} E</a></dd> <dt>Location</dt><dd><a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.lat_wgs84|floatformat:7}}&mlon={{ent.entrance.long_wgs84|floatformat:7}}">WGS84 Lat.: {{ ent.entrance.lat_wgs84|floatformat:7 }} N, Long.:{{ ent.entrance.long_wgs84|floatformat:7 }} E</a></dd>
{% endif %} {% endif %}
{% if ent.entrance.tag_station %} {% if ent.entrance.tag_station %}
<dt>Tag Location</dt><dd>{{ ent.entrance.tag_station }} <a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.tag.latlong.0}}&mlon={{ent.entrance.tag.latlong.1}}">{{ ent.entrance.tag.latlong.0|floatformat:5 }}N {{ ent.entrance.tag.latlong.1|floatformat:5 }}E</a> (UTM33 {{ ent.entrance.tag.x|floatformat:0 }}, {{ ent.entrance.tag.y|floatformat:0 }}), {{ ent.entrance.tag.z|floatformat:0 }}m</dd> <dt>Tag Location</dt><dd>{{ ent.entrance.tag_station }} <a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.tag.latlong.0}}&mlon={{ent.entrance.tag.latlong.1}}">{{ ent.entrance.tag.latlong.0|floatformat:5 }}N {{ ent.entrance.tag.latlong.1|floatformat:5 }}E</a> (UTM33 {{ ent.entrance.tag.x|floatformat:0 }}, {{ ent.entrance.tag.y|floatformat:0 }}), {{ ent.entrance.tag.z|floatformat:0 }}m (SRTM is {{ ent.entrance.tag.srtm_diff.0|safe }} m, distance from reference: {{ent.entrance.tag.srtm_alt.1|floatformat:0}}m)
</dd>
{% endif %} {% endif %}
{% if ent.entrance.bearings %} {% if ent.entrance.bearings %}
<dt>Bearings</dt><dd>{{ ent.entrance.bearings|safe }}</dd> <dt>Bearings</dt><dd>{{ ent.entrance.bearings|safe }}</dd>
@ -188,7 +189,7 @@
<dt>Other Station</dt><dd>{{ ent.entrance.other_station|safe }} <dt>Other Station</dt><dd>{{ ent.entrance.other_station|safe }}
{% if ent.entrance.other_description %} {% if ent.entrance.other_description %}
- {{ ent.entrance.other_description|safe }} - {{ ent.entrance.other_description|safe }}
{% endif %} <a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.other_location.latlong.0}}&mlon={{ent.entrance.other_location.latlong.1}}"> {{ ent.entrance.other_location.latlong.0|floatformat:7 }}N {{ ent.entrance.other_location.latlong.1|floatformat:7 }}E</a> (UTM33 {{ ent.entrance.other_location.x|floatformat:0 }}, {{ ent.entrance.other_location.y|floatformat:0 }}), {{ ent.entrance.other_location.z|floatformat:0 }}m {% endif %} <a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.other_location.latlong.0}}&mlon={{ent.entrance.other_location.latlong.1}}"> {{ ent.entrance.other_location.latlong.0|floatformat:7 }}N {{ ent.entrance.other_location.latlong.1|floatformat:7 }}E</a> (UTM33 {{ ent.entrance.other_location.x|floatformat:0 }}, {{ ent.entrance.other_location.y|floatformat:0 }}), {{ ent.entrance.other_location.z|floatformat:0 }}m (SRTM is {{ ent.entrance.other_location.srtm_diff.0|safe }}m, distance from reference: {{ent.entrance.other_location.srtm_alt.1|floatformat:0}}m)
</dd> </dd>
{% endif %} {% endif %}
</dl> </dl>