2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

srtm altitude parsing

This commit is contained in:
Philip Sargent 2023-11-18 12:38:07 +00:00
parent 688a1795e7
commit 76688695b8
2 changed files with 17 additions and 18 deletions

View File

@ -82,7 +82,7 @@ class Cave(TroggleModel):
references = models.TextField(blank=True, null=True)
survex_file = models.CharField(max_length=100, blank=True, null=True) # should be a foreign key?
survey = models.TextField(blank=True, null=True)
underground_centre_line = models.TextField(blank=True, null=True)
# underground_centre_line = models.TextField(blank=True, null=True)
underground_description = models.TextField(blank=True, null=True)
unofficial_number = models.CharField(max_length=60, blank=True, null=True)
url = models.CharField(max_length=300, blank=True, null=True, unique = True)

View File

@ -617,7 +617,7 @@ class LoadingSurvex:
SO we have to recognise the '*fix' too
"""
# *fix|36|reference|36359.40|82216.08|2000.00\n
rx_fixline = re.compile(r"(?i)^\s*[*]fix\s+([\w\d_\.\-]+)\s+(?:reference)?\s*([\d\.]*)\s+([\d\.]*)\s+([\d\.]*).*$")
rx_fixline = re.compile(r"(?i)^\s*[*]fix\s+([\w\d_\.\-]+)\s+(?:reference)?\s*([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s*;(.*)$")
line = line.replace("\n","")
#fixline = self.rx_fixline.match(line)
@ -644,7 +644,7 @@ class LoadingSurvex:
#_, _, alt, *rest = (fixdata + [None]*5)[:5]
name, _, _, alt, comment = (list(fixdata) + [None]*5)[:5]
fixid = str(survexblock.id)+ ":"+ name
self.fixes[fixid] = (survexblock, name)
self.fixes[fixid] = (survexblock, name, alt, comment)
message = f"{name}, {fixdata=}, last:{fixline.groups()[-1]}"
print(self.insp + message)
except Exception as e:
@ -2417,24 +2417,23 @@ def FindAndLoadSurvex():
for f in svx_load.fixes:
# why are we seeing no *fixes from fixedpts/gps18.svx etc. ? They are parsed !
survexblock, altitude, comment = svx_load.fixes[f]
survexblock, name, altitude, comment = svx_load.fixes[f]
s = survexblock
spath = ""
sprevious = None
while s.parent != sprevious:
spath += str(s.parent) + ":" + spath
sprevious = s
if not s.parent:
break
s = s.parent
spath = s.parent.survexfile
# sprevious = None
# while s.parent != sprevious:
# spath += str(s.parent) + ":" + spath
# sprevious = s
# if not s.parent:
# break
# s = s.parent
ff = survexblock.survexfile
if comment:
print(f"COMMENT {survexblock} {altitude} {comment}")
# print(f"FIX {survexblock} {altitude} {comment}")
if re.match("(?i)[^s]*srtm[\s\S]*", comment.lower()):
print(f"{f} - {spath}::{survexblock} - {comment}")
else:
if str(f).startswith("1623"):
print(f"{f} - {spath}::{survexblock} - {altitude=}")
print(f"SRTM {ff}.svx::{survexblock} - {spath}.svx - '{comment}'")
if re.match("(?i)[^s]*radost[\s\S]*", comment.lower()):
print(f"RDST {ff}.svx::{survexblock} - {spath}.svx - '{comment}'")
svx_load = None