mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 04:38:16 +00:00
improves stations srtm report
This commit is contained in:
@@ -75,16 +75,25 @@ class SurvexStation(models.Model):
|
||||
return utmToLatLng(33, self.x, self.y, northernHemisphere=True)[1]
|
||||
|
||||
def srtm_alt(self):
|
||||
return height_from_utm(self.x, self.y) # height, distance from reference point
|
||||
"""Caches the srtm data so that searches are not done twice on the same page"""
|
||||
if not hasattr(self,"srtm"):
|
||||
self.srtm = height_from_utm(self.x, self.y) # height, distance from reference point
|
||||
return self.srtm # (nearest point, nearest distance)
|
||||
|
||||
def srtm_diff(self):
|
||||
alt, ref = height_from_utm(self.x, self.y) # height, distance from reference point
|
||||
alt, ref = self.srtm_alt()
|
||||
|
||||
diff = alt - self.z
|
||||
if diff >= 0:
|
||||
diff_str = f"<span style='color:blue'>+{diff:.0f}</span>"
|
||||
colour = "blue"
|
||||
else:
|
||||
diff_str = f"<span style='color:red'>{diff:.0f}</span>"
|
||||
colour = "red"
|
||||
|
||||
if abs(diff) > 60:
|
||||
weight = "bold"
|
||||
else:
|
||||
weight = "normal"
|
||||
diff_str = f"<span style='color:{colour}; font-weight:{weight}'>{diff:.0f}</span>"
|
||||
|
||||
return diff_str, ref
|
||||
|
||||
|
||||
Reference in New Issue
Block a user