mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 05:55:06 +00:00
ported radosts SRTM altitude tool
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
from urllib.parse import urljoin
|
||||
@@ -6,7 +7,7 @@ from pathlib import Path
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
|
||||
from troggle.core.utils import height_from_utm
|
||||
|
||||
# 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]
|
||||
def long(self):
|
||||
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 ?
|
||||
if not northernHemisphere:
|
||||
|
||||
Reference in New Issue
Block a user