Stop storing SurvexStations fixups

This commit is contained in:
Philip Sargent
2020-06-15 19:48:53 +01:00
parent 7fe34bedb8
commit 09e9932711
4 changed files with 17 additions and 9 deletions

View File

@@ -11,7 +11,9 @@ from django.utils.timezone import get_current_timezone, make_aware
import troggle.settings as settings
import troggle.core.models as models
import troggle.core.models_survex as models_survex
from troggle.parsers.people import GetPersonExpeditionNameLookup
from troggle.core.views_caves import MapLocations
"""A 'survex block' is a *begin...*end set of cave data.
A 'survexscansfolder' is what we today call a "survey scans folder" or a "wallet".
@@ -20,7 +22,6 @@ A 'survexscansfolder' is what we today call a "survey scans folder" or a "wallet
line_leg_regex = re.compile(r"[\d\-+.]+$")
survexlegsalllength = 0.0
survexlegsnumber = 0
survexblockroot = None
def LoadSurvexLineLeg(survexblock, stardata, sline, comment, cave):
global survexlegsalllength
@@ -500,7 +501,7 @@ def LoadAllSurvexBlocks():
# Restore sys.stdout to our old saved file handler
sys.stdout = stdout_orig
print(" - total number of survex legs: {}m".format(survexlegsnumber))
print(" - total number of survex legs: {}".format(survexlegsnumber))
print(" - total leg lengths loaded: {}m".format(survexlegsalllength))
print(' - Loaded All Survex Blocks.')
@@ -565,6 +566,11 @@ def LoadPos():
call([settings.THREEDTOPOS, '%s.3d' % (topdata)], cwd = settings.SURVEX_DATA)
print(" - This next bit takes a while. Matching ~32,000 survey positions. Be patient...")
mappoints = {}
for pt in MapLocations().points():
svxid, number, point_type, label = pt
mappoints[svxid]=True
posfile = open("%s.pos" % (topdata))
posfile.readline() #Drop header
@@ -572,9 +578,9 @@ def LoadPos():
for line in posfile.readlines():
r = poslineregex.match(line)
if r:
x, y, z, name = r.groups() # easting, northing, altitude
if name in notfoundbefore:
skip[name] = 1
x, y, z, id = r.groups()
if id in notfoundbefore:
skip[id] = 1
else:
for sid in mappoints:
if id.endswith(sid):