mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-29 21:31:54 +00:00
Stop storing SurvexStations fixups
This commit is contained in:
parent
7fe34bedb8
commit
09e9932711
2
core/views_caves.py
Normal file → Executable file
2
core/views_caves.py
Normal file → Executable file
@ -9,12 +9,14 @@ import troggle.core.models as models
|
||||
import troggle.settings as settings
|
||||
from troggle.helper import login_required_if_public
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from django.forms.models import modelformset_factory
|
||||
from django import forms
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.conf import settings
|
||||
import re
|
||||
import os
|
||||
import urlparse
|
||||
#import urllib.parse
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
|
@ -65,9 +65,9 @@ def dirsredirect():
|
||||
#should also deal with permissions here.
|
||||
#if not os.path.isdir(settings.PHOTOS_ROOT):
|
||||
#os.mkdir(settings.PHOTOS_ROOT)
|
||||
for oldURL, newURL in [("indxal.htm", reverse("caveindex"))]:
|
||||
f = troggle.flatpages.models.Redirect(originalURL = oldURL, newURL = newURL)
|
||||
f.save()
|
||||
# for oldURL, newURL in [("indxal.htm", reverse("caveindex"))]:
|
||||
# f = troggle.flatpages.models.Redirect(originalURL = oldURL, newURL = newURL)
|
||||
# f.save()
|
||||
|
||||
def import_caves():
|
||||
import troggle.parsers.caves
|
||||
|
@ -89,7 +89,7 @@ def readcave(filename):
|
||||
with open(os.path.join(settings.CAVEDESCRIPTIONS, filename)) as f:
|
||||
contents = f.read()
|
||||
context = " in file %s" % filename
|
||||
print "Reading file %s" % filename
|
||||
#print "Reading file %s" % filename
|
||||
cavecontentslist = getXML(contents, "cave", maxItems = 1, context = context)
|
||||
#print cavecontentslist
|
||||
if len(cavecontentslist) == 1:
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user