From df8618d0f0c7df09a90ecad9ef7885ee4da39e01 Mon Sep 17 00:00:00 2001
From: expo <expo@expobox.potato.hut>
Date: Thu, 1 Aug 2013 17:00:01 +0200
Subject: [PATCH] Prospecting guide and images and few minor other things.

---
 .hgignore                     |   1 +
 core/admin.py                 |   1 +
 core/imageposcalc.ods         | Bin 0 -> 11110 bytes
 core/models.py                |  70 +++++++---
 core/views_caves.py           | 233 +++++++++++++++++++++++++++++++++-
 core/views_survex.py          |   5 +-
 localsettingsubuntu.py        |  16 +--
 settings.py                   |   4 +-
 templates/cave_entrances.html |   4 +-
 templates/prospecting.html    |  68 +++++++---
 urls.py                       |   2 +
 11 files changed, 354 insertions(+), 50 deletions(-)
 create mode 100644 core/imageposcalc.ods

diff --git a/.hgignore b/.hgignore
index ad091eb..cb29426 100644
--- a/.hgignore
+++ b/.hgignore
@@ -6,3 +6,4 @@ db*
 localsettings.py
 *~
 parsing_log.txt
+troggle
diff --git a/core/admin.py b/core/admin.py
index 0192807..0c8b605 100644
--- a/core/admin.py
+++ b/core/admin.py
@@ -120,6 +120,7 @@ admin.site.register(LogbookEntry, LogbookEntryAdmin)
 admin.site.register(QM, QMAdmin)
 admin.site.register(Survey, SurveyAdmin)
 admin.site.register(ScannedImage)
+admin.site.register(SurvexStation)
 
 admin.site.register(SurvexScansFolder)
 admin.site.register(SurvexScanSingle)
diff --git a/core/imageposcalc.ods b/core/imageposcalc.ods
new file mode 100644
index 0000000000000000000000000000000000000000..0cc2135652981d47a57a5fe8393eed70fd696f38
GIT binary patch
literal 11110
zcmeHtbzD?i*DxuKNJvOYhje#Hmvn~%j5I?GUD72X0@B^x=>U>~(kUSdf;3VBL%jp)
z)q5ZB^L^hx-(T<Mcjlb4&+5JRT6-^+sv;s1J{%k>92}tjN;241Ac7SR4(|Gbb-~$L
z*#W^G4nTl|gRPYr0Bi-aXLGeTX9WSAt(;jw4nTWzkeQ1e&>qa{?BE0hm^)hnfne3Y
z(Of!_oEEwb2X}oD!Dwn)y4ac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e1G-vq@Tk?EntW|Bp&KfE-*LV2;V<zu^5z)N7PqqW)=o31FfsOKVE7$g9Y(*#YdW
zo&cS1@<QbrukE`iF(JpyR6G9Vg=jq6*<)>4XK*rU_-L4&1=d%-^7*{U1xlq;sZp7W
zUPQI;(*rA2V*90SyGy<A5M)J_ceUN22t9@>Z#9%Ev#$wKPBmtcKx22Ts1;<$umr{|
z5n`W|njzTcvcSh4xxH#*TBuF-ub-(Xk*{<n-^dm-p#$r@s(kUujCumMA55C%Qn0ER
zAd?jTsx|~ANf5wX8L~28m>2)L4vh3To4neIKk;jLuZOxf2C&ojbp%EM3eOaU`u)e`
zA3{E}4<kPb;VP{@$El8bvwV>`sOY`-)w>mbMmQZzQSI#0KaHGS&p8zkdOu3<ecZwB
z!D;3c1z#e1^j&kuu_0oay(s9Oa-+$0Ty!(=*~f#2gZl)FeyWP_2>5XSUK{sg*8aHt
ztd#pF)<3J?eqm|C9{;Tt?kAO>WBPmU?>eRbtM$OD>V8k~{}c1~v(|NP@K<ZV`&*{)
zpNPM25w4G7zuHsSLj83x`-%5+MgMaH@e2=u5>`+Mb8pw%iGO1Kg8J^ve!Z7b|L5xd
z-L-umq@RYm#{21?uASSj_W2KV{>9b(H{q_=;jbn{^Pj@~a&&*6Kfkd4siNZ_sQm8u
z{+-UX>-*J;|3K&Oj_}_p{avr+KT!JR82_EhwQKy<h-v@RI{)D)|DD)%JoweL|3K__
z$NBGc{;pc|AL#sYq~EFhoK3&GgKJm%t98Su{L!(hDk8%&8*p$qus>cT*ht^Z!v6sn
C_QK%+

literal 0
HcmV?d00001

diff --git a/core/models.py b/core/models.py
index e064814..a3bd832 100644
--- a/core/models.py
+++ b/core/models.py
@@ -249,7 +249,7 @@ class LogbookEntry(TroggleModel):
     filename  = models.CharField(max_length=200,null=True)
 
     class Meta:
-	verbose_name_plural = "Logbook Entries"
+        verbose_name_plural = "Logbook Entries"
         # several PersonTrips point in to this object
         ordering = ('-date',)
         
@@ -397,11 +397,14 @@ class Cave(TroggleModel):
 
 
     #href    = models.CharField(max_length=100)
+    
+    class Meta:
+        ordering = ('kataster_code', 'unofficial_number')  
 
     def hassurvey(self):
         if not self.underground_centre_line:
             return "No"
-        if (self.underground_centre_line.find("<img") > -1 or self.underground_centre_line.find("<a") > -1):
+        if (self.survey.find("<img") > -1 or self.survey.find("<a") > -1 or self.survey.find("<IMG") > -1 or self.survey.find("<A") > -1):
             return "Yes"
         return "Missing"
 
@@ -501,8 +504,17 @@ class Cave(TroggleModel):
         u8 = u.encode("utf-8")
         f.write(u8)
         f.close()
-
-    
+        
+    def getArea(self):
+        areas = self.area.all()
+        lowestareas = list(areas)
+        for area in areas:
+			if area.parent in areas:
+				try:
+					lowestareas.remove(area.parent)
+				except:
+					pass
+        return lowestareas[0]
 
 def getCaveByReference(reference):
     areaname, code = reference.split("-", 1)
@@ -539,7 +551,7 @@ class Entrance(TroggleModel):
         ('P?', 'Paint (?)'),
         ('T', 'Tag'),
         ('T?', 'Tag (?)'),
-        ('R', 'Retagged'),
+        ('R', 'Needs Retag'),
         ('S', 'Spit'),
         ('S?', 'Spit (?)'),
         ('U', 'Unmarked'),
@@ -548,7 +560,7 @@ class Entrance(TroggleModel):
     marking_comment = models.TextField(blank=True,null=True)
     FINDABLE_CHOICES = (
         ('?', 'To be confirmed ...'),
-        ('S', 'Surveyed'),
+        ('S', 'Coordinates'),
         ('L', 'Lost'),
         ('R', 'Refindable'))
     findability = models.CharField(max_length=1, choices=FINDABLE_CHOICES, blank=True, null=True)
@@ -575,21 +587,46 @@ class Entrance(TroggleModel):
 
 
     def find_location(self):
+        r = {'':  'To be entered ',
+			 '?': 'To be confirmed:',
+             'S': '',
+             'L': 'Lost:',
+             'R': 'Refindable:'}[self.findability]
         if self.tag_station:
-            s = SurvexStation.objects.lookup(self.tag_station)
-            return "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
+            try:
+                s = SurvexStation.objects.lookup(self.tag_station)
+                return r + "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
+            except:
+				return r + "%s Tag Station not in dataset" % self.tag_station
         if self.exact_station:
-            s = SurvexStation.objects.lookup(self.exact_station)
-            return "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
+            try:
+                s = SurvexStation.objects.lookup(self.exact_station)
+                return r + "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
+            except:
+				return r + "%s Exact Station not in dataset" % self.tag_station
         if self.other_station:
-            s = SurvexStation.objects.lookup(self.other_station)
-            return "%0.0fE %0.0fN %0.0fAlt %s" % (s.x, s.y, s.z, self.other_description)
-	if self.bearings:
-            return self.bearings
+            try:
+                s = SurvexStation.objects.lookup(self.other_station)
+                return r + "%0.0fE %0.0fN %0.0fAlt %s" % (s.x, s.y, s.z, self.other_description)
+            except:
+				return r + "%s Other Station not in dataset" % self.tag_station
+        if self.FINDABLE_CHOICES == "S":
+			r += "ERROR, Entrance has been surveyed but has no survex point"
+        if self.bearings:
+            return r + self.bearings
+        return r
+
+    def best_station(self):
+        if self.tag_station:
+            return self.tag_station
+        if self.exact_station:
+            return self.exact_station
+        if self.other_station:
+            return self.other_station
 
     def has_photo(self):
         if self.photo:
-            if (self.photo.find("<img") > -1 or self.photo.find("<a") > -1):
+            if (self.photo.find("<img") > -1 or self.photo.find("<a") > -1 or self.photo.find("<IMG") > -1 or self.photo.find("<A") > -1):
                 return "Yes"
             else:
                 return "Missing"
@@ -607,6 +644,9 @@ class Entrance(TroggleModel):
                 
     def tag(self):
         return SurvexStation.objects.lookup(self.tag_station)
+        
+    def needs_surface_work(self):
+		return self.findability != "S" or not self.has_photo or self.marking != "T"
 
     def get_absolute_url(self):
         
diff --git a/core/views_caves.py b/core/views_caves.py
index 16dbaac..7a266b5 100644
--- a/core/views_caves.py
+++ b/core/views_caves.py
@@ -1,4 +1,7 @@
-from troggle.core.models import CaveSlug, Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription, EntranceSlug, Entrance, Area
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+from troggle.core.models import CaveSlug, Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription, EntranceSlug, Entrance, Area, SurvexStation
 from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm
 import troggle.core.models as models
 import troggle.settings as settings
@@ -8,10 +11,13 @@ from django.forms.models import modelformset_factory
 from django import forms
 from django.core.urlresolvers import reverse
 from utils import render_with_context # see views_logbooks for explanation on this.
-from django.http import HttpResponseRedirect
+from django.http import HttpResponse, HttpResponseRedirect
 from django.conf import settings
 import re, urlparse
 from django.shortcuts import get_object_or_404
+import settings
+
+import Image, ImageDraw, ImageFont, string, os, sys
 
 def getCave(cave_id):
     """Returns a cave object when given a cave name or number. It is used by views including cavehref, ent, and qm."""
@@ -249,19 +255,21 @@ def get_qms(request, caveslug):
     return render_with_context(request,'options.html', {"items": [(e.entrance.slug(), e.entrance.slug()) for e in cave.entrances()]})
 
 areanames = [
-	#('',     'Location unclear'),
+	('',     'Location unclear'),
 	('1a',   '1a &ndash; Plateau: around Top Camp'),
 	('1b',   '1b &ndash; Western plateau near 182'),
 	('1c',   '1c &ndash; Eastern plateau near 204 walk-in path'),
 	('1d',   '1d &ndash; Further plateau around 76'),
 	('2a',   '2a &ndash; Southern Schwarzmooskogel near 201 path and the Nipple'),
 	('2b',   '2b &ndash; Eish&ouml;hle area'),
+	('2b or 4 (unclear)', '2b or 4 (unclear)'),
 	('2c',   '2c &ndash; Kaninchenh&ouml;hle area'),
 	('2d',   '2d &ndash; Steinbr&uuml;ckenh&ouml;hle area'),
 	('3',    '3 &ndash; Br&auml;uning Alm'),
 	('4',	'4 &ndash; Kratzer valley'),
 	('5',	'5 &ndash; Schwarzmoos-Wildensee'),
 	('6',	'6 &ndash; Far plateau'),
+	('1626 or 6 (borderline)', '1626 or 6 (borderline)'),
 	('7',	'7 &ndash; Egglgrube'),
 	('8a',	'8a &ndash; Loser south face'),
 	('8b',	'8b &ndash; Loser below Dimmelwand'),
@@ -274,8 +282,221 @@ areanames = [
 
 
 def prospecting(request):
+    #for key, name in areanames:
+    #    print key, Area.objects.get(short_name = key)
+    areas = []
     for key, name in areanames:
-        print key, Area.objects.get(short_name = key)
-    areas = [ (name, Area.objects.get(short_name = key)) for key, name in areanames ]
-    return render_with_context(request,'prospecting.html', {"areas": areas})
+        a = Area.objects.get(short_name = key)
+        caves = list(a.cave_set.all())
+        caves.sort(caveCmp)
+        areas.append((name, a, caves))
+    return render_with_context(request, 'prospecting.html', {"areas": areas})
+    
+# Parameters for big map and zoomed subarea maps:
+# big map first (zoom factor ignored)
+
+maps = {
+# id	left		top			right		bottom		zoom
+#		G&K			G&K			G&K			G&K			factor
+"all": [33810.4,	85436.5,	38192.0,		81048.2,	0.35,
+		"All"],
+"40":  [36275.6,	82392.5,	36780.3,	81800.0,	3.0,
+		"Eish&ouml;hle"],
+"76":  [35440.0,	83220.0,	36090.0,	82670.0,	1.3,
+		"Eislufth&ouml;hle"],
+"204": [36354.1,	84154.5,	37047.4,	83300,	3.0,
+		"Steinbr&uuml;ckenh&ouml;hle"],
+"tc":  [35230.0,	82690.0,	36110.0,	82100.0,	3.0,
+		"Near Top Camp"],
+"grieß":
+       [36000.0,	86300.0,	38320.0,	84400.0,	4.0,
+		"Grießkogel Area"],
+}
+
+for n in maps.keys():
+    L, T, R, B, S, name = maps[n]
+    W = (R-L)/2
+    H = (T-B)/2
+    for i in range(2):
+	    for j in range(2):
+		    maps["%s%i%i" % (n, i, j)] = [L + i * W, T - j * H, L + (i + 1) * W, T - (j + 1) * H, S, name]
+# Keys in the order in which we want the maps output
+mapcodes = ["all", "grieß","40", "76", "204", "tc"] 
+# Field codes
+L = 0
+T = 1
+R = 2
+B = 3
+ZOOM = 4
+DESC = 5
+
+areacolours = {
+	'1a' : '#00ffff',
+	'1b' : '#ff00ff',
+	'1c' : '#ffff00',
+	'1d' : '#ffffff',
+	'2a' : '#ff0000',
+	'2b' : '#00ff00',
+	'2c' : '#008800',
+	'2d' : '#ff9900',
+	'3'  : '#880000',
+	'4'  : '#0000ff',
+	'6'  : '#000000', # doubles for surface fixed pts, and anything else
+	'7'  : '#808080'
+	}
+
+
+for FONT in [
+		"/usr/share/fonts/truetype/freefont/FreeSans.ttf",
+		"/usr/X11R6/lib/X11/fonts/truetype/arial.ttf",
+		"C:\WINNT\Fonts\ARIAL.TTF"
+		]:
+	if os.path.isfile(FONT): break
+TEXTSIZE = 16
+CIRCLESIZE =8
+LINEWIDTH = 2
+myFont = ImageFont.truetype(FONT, TEXTSIZE)
+
+def mungecoord(x, y, mapcode, img):
+	# Top of Zinken is 73 1201 = dataset 34542 81967
+	# Top of Hinter is 1073 562 = dataset 36670 83317
+	# image is 1417 by 2201
+	# FACTOR1 = 1000.0 / (36670.0-34542.0)
+	# FACTOR2 = (1201.0-562.0) / (83317 - 81967)
+	# FACTOR = (FACTOR1 + FACTOR2)/2 
+	# The factors aren't the same as the scanned map's at a slight angle. I
+	# can't be bothered to fix this.  Since we zero on the Hinter it makes
+	# very little difference for caves in the areas round 76 or 204.
+	# xoffset = (x - 36670)*FACTOR
+	# yoffset = (y - 83317)*FACTOR
+	# return (1073 + xoffset, 562 - yoffset)
+
+	m = maps[mapcode]
+	factorX, factorY = img.size[0] / (m[R] - m[L]), img.size[1] / (m[T] - m[B])
+	return ((x - m[L]) * factorX, (m[T] - y) * factorY)
+	
+COL_TYPES = {True: "red",
+             False: "#dddddd",
+             "Reference": "#dddddd"}
+	
+def plot(surveypoint, number,  point_type, label, mapcode, draw, img):
+    try:
+        ss = SurvexStation.objects.lookup(surveypoint)
+        E, N = ss.x, ss.y
+        shortnumber = number.replace("&mdash;","")
+        (x,y) = map(int, mungecoord(E, N, mapcode, img))
+        #imgmaps[maparea].append( [x-4, y-SIZE/2, x+4+draw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
+        draw.rectangle([(x+CIRCLESIZE, y-TEXTSIZE/2), (x+CIRCLESIZE*2+draw.textsize(shortnumber)[0], y+TEXTSIZE/2)], fill="#ffffff")
+        draw.text((x+CIRCLESIZE * 1.5,y-TEXTSIZE/2), shortnumber, fill="#000000")
+        draw.ellipse([(x-CIRCLESIZE,y-CIRCLESIZE),(x+CIRCLESIZE,y+CIRCLESIZE)], fill=COL_TYPES[point_type], outline="#000000")
+    except:
+        pass
+
+def prospecting_image(request, name):
+
+    mainImage = Image.open(os.path.join(settings.SURVEY_SCANS, "location_maps", "pguidemap.jpg"))
+    if settings.PUBLIC_SITE and not request.user.is_authenticated():
+	    mainImage = Image.new("RGB", mainImage.size, '#ffffff')
+    m = maps[name]
+    #imgmaps = []
+    if name == "all":
+		img = mainImage
+    else:
+		M = maps['all']
+		W, H = mainImage.size
+		l = int((m[L] - M[L]) / (M[R] - M[L]) * W)
+		t = int((m[T] - M[T]) / (M[B] - M[T]) * H)
+		r = int((m[R] - M[L]) / (M[R] - M[L]) * W)
+		b = int((m[B] - M[T]) / (M[B] - M[T]) * H)
+		img = mainImage.crop((l, t, r, b))
+		w = int(round(m[ZOOM] * (m[R] - m[L]) / (M[R] - M[L]) * W))
+		h = int(round(m[ZOOM] * (m[B] - m[T]) / (M[B] - M[T]) * H))
+		img = img.resize((w, h), Image.BICUBIC)
+    draw = ImageDraw.Draw(img)
+    draw.setfont(myFont)
+    if name == "all":
+        for maparea in maps.keys():
+			if maparea == "all":
+				continue
+			localm = maps[maparea]
+			l,t = mungecoord(localm[L], localm[T], "all", img)
+			r,b = mungecoord(localm[R], localm[B], "all", img)
+			text = maparea + " map"
+			textlen = draw.textsize(text)[0] + 3
+			draw.rectangle([l, t, l+textlen, t+TEXTSIZE+2], fill='#ffffff')
+			draw.text((l+2, t+1), text, fill="#000000")
+			#imgmaps.append( [l, t, l+textlen, t+SIZE+2, "submap" + maparea, maparea + " subarea map"] )
+			draw.line([l, t, r, t], fill='#777777', width=LINEWIDTH)
+			draw.line([l, b, r, b], fill='#777777', width=LINEWIDTH)
+			draw.line([l, t, l, b], fill='#777777', width=LINEWIDTH)
+			draw.line([r, t, r, b], fill='#777777', width=LINEWIDTH)
+			draw.line([l, t, l+textlen, t], fill='#777777', width=LINEWIDTH)
+			draw.line([l, t+TEXTSIZE+2, l+textlen, t+TEXTSIZE+2], fill='#777777', width=LINEWIDTH)
+			draw.line([l, t, l, t+TEXTSIZE+2], fill='#777777', width=LINEWIDTH)
+			draw.line([l+textlen, t, l+textlen, t+TEXTSIZE+2], fill='#777777', width=LINEWIDTH)
+    #imgmaps[maparea] = []
+    # Draw scale bar
+    m100 = int(100 / (m[R] - m[L]) * img.size[0])
+    draw.line([10, TEXTSIZE*3, 10, TEXTSIZE*2], fill='#000000', width=LINEWIDTH)
+    draw.line([10, TEXTSIZE*2, 10+m100, TEXTSIZE*2], fill='#000000', width=LINEWIDTH)
+    draw.line([10+m100, TEXTSIZE * 3, 10+m100, TEXTSIZE*2], fill='#000000', width=LINEWIDTH)
+    label = "100m"
+    draw.text([10 + (m100 - draw.textsize(label)[0]) / 2, TEXTSIZE/2], label, fill='#000000')
+    plot("laser.0_7", "BNase", "Reference", "Br&auml;uning Nase laser point", name, draw, img)
+    plot("226-96", "BZkn", "Reference", "Br&auml;uning Zinken trig point", name, draw, img)
+    plot("vd1","VD1","Reference", "VD1 survey point", name, draw, img)
+    plot("laser.kt114_96","HSK","Reference", "Hinterer Schwarzmooskogel trig point", name, draw, img) 
+    plot("2000","Nipple","Reference", "Nipple (Wei&szlig;e Warze)", name, draw, img)
+    plot("3000","VSK","Reference", "Vorderer Schwarzmooskogel summit", name, draw, img)
+    plot("topcamp", "TC", "Reference", "Top Camp", name, draw, img)
+    plot("laser.0", "LSR0", "Reference", "Laser Point 0", name, draw, img)
+    plot("laser.0_1", "LSR1", "Reference", "Laser Point 0/1", name, draw, img)
+    plot("laser.0_3", "LSR3", "Reference", "Laser Point 0/3", name, draw, img)
+    plot("laser.0_5", "LSR5", "Reference", "Laser Point 0/5", name, draw, img)
+    plot("225-96", "BAlm", "Reference", "Br&auml;uning Alm trig point", name, draw, img)
+    for entrance in Entrance.objects.all():
+		station = entrance.best_station()
+		if station:
+			#try:
+				areaName = entrance.caveandentrance_set.all()[0].cave.getArea().short_name
+				plot(station, "%s-%s" % (areaName, str(entrance)[5:]), entrance.needs_surface_work(), str(entrance), name, draw, img)
+			#except:
+			#	pass
+				
+    for (N, E, D, num) in [(35975.37,	83018.21,	100,"177"),	# Calculated from bearings
+                           (35350.00,	81630.00,	50,	"71"),	# From Auer map
+                           (36025.00,	82475.00,	50,	"146"),	# From mystery map
+                           (35600.00,	82050.00,	50,	"35"),	# From Auer map
+                           (35650.00,	82025.00,	50,	"44"),	# From Auer map
+                           (36200.00,	82925.00,	50,	"178"),	# Calculated from bearings
+                           (35232.64,	82910.37,	25,	"181"),	# Calculated from bearings
+                           (35323.60,	81357.83,	50,	"74")	# From Auer map
+                           ]:
+        (N,E,D) = map(float, (N, E, D))
+        maparea = Cave.objects.get(kataster_number = num).getArea().short_name
+        lo = mungecoord(N-D, E+D, name, img)
+        hi = mungecoord(N+D, E-D, name, img)
+        lpos = mungecoord(N-D, E, name, img)
+        draw.ellipse([lo,hi], outline="#000000")
+        draw.ellipse([lo[0]+1, lo[1]+1, hi[0]-1, hi[1]-1], outline=areacolours[maparea])
+        draw.ellipse([lo[0]+2, lo[1]+2, hi[0]-2, hi[1]-2], outline=areacolours[maparea])
+        draw.rectangle([lpos[0],lpos[1]-TEXTSIZE/2, lpos[0] + draw.textsize(name)[0], lpos[1]+TEXTSIZE/2], fill="#ffffff")
+        draw.text((lpos[0], lpos[1]-TEXTSIZE/2), num, fill="#000000")
+    response = HttpResponse(content_type = "image/png")
+    del draw
+    img.save(response, "PNG")
+    return response
+ 
+STATIONS = {}   
+poslineregex = re.compile("^\(\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*)\s*\)\s*([^\s]+)$")
+def LoadPos():
+    call([settings.CAVERN, "--output=%s/all.3d" % settings.SURVEX_DATA, "%s/all.svx" % settings.SURVEX_DATA])
+    call([settings.THREEDTOPOS, '%sall.3d' % settings.SURVEX_DATA], cwd = settings.SURVEX_DATA)
+    posfile = open("%sall.pos" % settings.SURVEX_DATA)
+    posfile.readline()#Drop header
+    for line in posfile.readlines():
+        r = poslineregex.match(line)                
+        if r:
+            x, y, z, name = r.groups()
+            STATIONS[name] = (x, y, z)
 
diff --git a/core/views_survex.py b/core/views_survex.py
index cf3b556..3c53625 100644
--- a/core/views_survex.py
+++ b/core/views_survex.py
@@ -243,7 +243,8 @@ def identifycavedircontents(gcavedir):
             else:
                 subsvx.append(nf)
         else:
-            assert re.match(".*?(?:.3d|.log|.err|.txt|.tmp|.diff|.e?spec|~)$", f), (gcavedir, f)
+            pass
+            #assert re.match(".*?(?:.3d|.log|.err|.txt|.tmp|.diff|.e?spec|~)$", f), (gcavedir, f)
     subsvx.sort()
     #assert primesvx, (gcavedir, subsvx)
     if primesvx:
@@ -317,4 +318,4 @@ def survexcavesingle(request, survex_cave):
     
     
     
-    
\ No newline at end of file
+    
diff --git a/localsettingsubuntu.py b/localsettingsubuntu.py
index 5a1f944..fcc8a73 100644
--- a/localsettingsubuntu.py
+++ b/localsettingsubuntu.py
@@ -2,13 +2,13 @@ import sys
 # link localsettings to this file for use on expo computer in austria
 
 DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': 'troggle',                      # Or path to database file if using sqlite3.
-        'USER': 'expo',                      # Not used with sqlite3.
-        'PASSWORD': 'gosser',                  # Not used with sqlite3.
-        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
-        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
+    'default': { 
+        'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+        'NAME' : 'troggle',     # Or path to database file if using sqlite3.
+        'USER' : 'expo',        # Not used with sqlite3.
+        'PASSWORD' : 'gosser',  # Not used with sqlite3.
+        'HOST' : '',            # Set to empty string for localhost. Not used with sqlite3.
+        'PORT' : '',            # Set to empty string for default. Not used with sqlite3.
     }
 }
 
@@ -30,7 +30,7 @@ SURVEY_SCANS = REPOS_ROOT_PATH + 'expoimages/'
 FILES = REPOS_ROOT_PATH + 'expoimages'
 
 
-PYTHON_PATH = REPOS_ROOT_PATH + 'hg/troggle/'
+PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
 
 #URL_ROOT = 'http://127.0.0.1:8000'
 URL_ROOT = "http://expoweb/"
diff --git a/settings.py b/settings.py
index 47d48ae..0032c2a 100644
--- a/settings.py
+++ b/settings.py
@@ -52,8 +52,8 @@ SECRET_KEY = 'a#vaeozn0)uz_9t_%v5n#tj)m+%ace6b_0(^fj!355qki*v)j2'
 
 # List of callables that know how to import templates from various sources.
 TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.load_template_source',
-    'django.template.loaders.app_directories.load_template_source',
+    'django.template.loaders.filesystem.Loader',
+    'django.template.loaders.app_directories.Loader',
 #   'django.template.loaders.eggs.load_template_source',
 )
 
diff --git a/templates/cave_entrances.html b/templates/cave_entrances.html
index 3a75a02..5b70196 100644
--- a/templates/cave_entrances.html
+++ b/templates/cave_entrances.html
@@ -46,13 +46,13 @@
             <dt>Location</dt><dd>{{ ent.entrance.northing|safe }}, {{ ent.entrance.easting|safe }}, {{ ent.entrance.alt|safe }}m</dd>
         {% endif %}
         {% if ent.entrance.tag_station %}
-            <dt>Tag Location</dt><dd>{{ ent.entrance.tag_station }}{{ ent.entrance.tag.y|safe }}, {{ ent.entrance.tag.x|safe }}, {{ ent.entrance.tag.z|safe }}m</dd>
+            <dt>Tag Location</dt><dd>{{ ent.entrance.tag_station }} {{ ent.entrance.tag.y|safe }}, {{ ent.entrance.tag.x|safe }}, {{ ent.entrance.tag.z|safe }}m</dd>
         {% endif %}
         {% if ent.entrance.bearings %}
             <dt>Bearings</dt><dd>{{ ent.entrance.bearings|safe }}</dd>
         {% endif %}
         {% if ent.entrance.exact_station %}
-            <dt>Exact Station</dt><dd>{{ ent.entrance.exact_station|safe }} {{ ent.exact_location.tag.y|safe }}, {{ ent.entrance.exact_location.x|safe }}, {{ ent.entrance.exact_location.z|safe }}m</dd>
+            <dt>Exact Station</dt><dd>{{ ent.entrance.exact_station|safe }} {{ ent.entrance.exact_location.y|safe }}, {{ ent.entrance.exact_location.x|safe }}, {{ ent.entrance.exact_location.z|safe }}m</dd>
         {% endif %}
         {% if ent.entrance.other_station %}
             <dt>Other Station</dt><dd>{{ ent.entrance.other_station|safe }}
diff --git a/templates/prospecting.html b/templates/prospecting.html
index 0d7a0d6..a2ab512 100644
--- a/templates/prospecting.html
+++ b/templates/prospecting.html
@@ -11,18 +11,18 @@
 <li>For more info on each cave, see the links to detailed description pages.</li>
 </ul>
 
-{% for name, area in areas %}
+{% for name, area, caves in areas %}
  <h2>{{name|safe}}</h2>
- <table border=\"1\" width="100%">
- <col><col><col><col><col><col><col><col><col width="45%">
+ <table border="1" width="100%">
+ <col><col><col><col><col><col><col><col><col>
  <thead>
- <tr><th>Cave Number</th><th>Name</th><th>Finished</th><th>Survey<br>Data</th><th>Survey<br>Drawn</th><th>Marked</th><th>Photo</th><th>Position</th><th>Location</th></tr>
+ <tr><th>Cave Number</th><th>Name</th><th>Finished</th><th>Survey<br>Data</th><th>Survey<br>Drawn</th><th>Marked</th><th>Photo</th><th>Position</th></tr>
  </thead>
  <tbody>  
- {% for cave in area.cave_set.all %}
+ {% for cave in caves %}
   {% if cave.singleentrance %}
    <tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}>
-     <td>{{ cave }}</td>
+     <td><a href="/{{ cave.url }}">{{ cave }}</a></td>
      <td>{{ cave.official_name|safe }}</td>
      <td>{{ cave.kataster_code }}</td>
      <td>{{ cave.hassurveydata }}</td>
@@ -30,13 +30,32 @@
      <td>{{ cave.caveandentrance_set.all.0.entrance.marking_val }}</td>
      <td>{{ cave.caveandentrance_set.all.0.entrance.has_photo }} </td>
      <td>{{ cave.caveandentrance_set.all.0.entrance.find_location }}</td>
-     <td>{% if cave.caveandentrance_set.all.0.entrance.location_description %}Location: {{ cave.caveandentrance_set.all.0.entrance.location_description|safe }}{% endif %}
-         {% if cave.caveandentrance_set.all.0.entrance.map_description %}Map: {{ cave.caveandentrance_set.all.0.entrance.map_description|safe }}{% endif %}	
-         {% if cave.caveandentrance_set.all.0.entrance.approach %}Approach: {{ cave.caveandentrance_set.all.0.entrance.approach|safe }}{% endif %}</td>
    </tr>
+   {% if cave.caveandentrance_set.all.0.entrance.location_description %}
+       <tr><th>Location</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.location_description|safe }}</td></tr>
+   {% endif %}
+   {% if cave.caveandentrance_set.all.0.entrance.map_description %}
+       <tr><th>Map</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.map_description|safe }}</td></tr>
+   {% endif %}	
+   {% if cave.caveandentrance_set.all.0.entrance.approach %}
+       <tr><th>Approach</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.approach|safe }}</td></tr>
+   {% endif %}
+   {% if cave.caveandentrance_set.all.0.entrance.findability_description %}
+       <tr><th>Findability</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.findability_description|safe }}</td></tr>
+   {% endif %}
+   {% if cave.caveandentrance_set.all.0.entrance.marking_comment %}
+       <tr><th>Marking</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.marking_comment|safe }}</td></tr>
+   {% endif %}
+   {% if cave.caveandentrance_set.all.0.entrance.entrance_description %}
+       <tr><th>Ent Desc</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.entrance_description|safe }}</td></tr>
+   {% endif %}
+   {% if cave.underground_description %}
+       <tr><th>Under Desc</th><td colspan="9">{{ cave.underground_description|truncatewords_html:80 }}</td></tr>
+   {% endif %}
+
   {% else %}
    <tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}>
-     <td>{{ cave }}</td>
+     <td><a href="/{{ cave.url }}">{{ cave }}</a></td>
      <td>{{ cave.official_name|safe }}</td>
      <td>{{ cave.kataster_code }}</td>
      <td>{{ cave.hassurveydata }}</td>
@@ -46,20 +65,39 @@
      <td></td>
      <td></td>
     </tr>
+   {% if cave.underground_description %}
+       <tr><th>Under Desc</th><td colspan="9">{{ cave.underground_description|truncatewords_html:80 }}</td></tr>
+   {% endif %}
    {% for caveandentrance in cave.caveandentrance_set.all %} 
     <tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}>
-     <td>{{ caveandentrance.entrance_letter}}</td>
+     <td><a href="/{{ cave.url }}">{{ caveandentrance.entrance_letter}}</a></td>
      <td>{{ caveandentrance.entrance.name|safe }}</td>
      <td></td>
      <td></td>
      <td></td>
      <td>{{ caveandentrance.entrance.marking_val }}</td>
      <td>{{ caveandentrance.entrance.has_photo }} </td>
-     <td>{{ caveandentrance.entrance.find_location|safe }}</td>
-     <td>{% if cave.caveandentrance_set.all.0.entrance.location_description %}Location: {{ cave.caveandentrance_set.all.0.entrance.location_description|safe }}{% endif %}
-         {% if cave.caveandentrance_set.all.0.entrance.map_description %}Map: {{ cave.caveandentrance_set.all.0.entrance.map_description|safe }}{% endif %}
-         {% if cave.caveandentrance_set.all.0.entrance.approach %}Approach: {{ cave.caveandentrance_set.all.0.entrance.approach|safe }}{% endif %}</td>
+     <td>{{ caveandentrance.entrance.find_location|safe }}</td> 
     </tr>
+    <tr>
+    {% if caveandentrance.entrance.location_description %}
+      <tr><td>Location</td><td colspan="9">{{ caveandentrance.entrance.location_description|safe }}</td></tr>
+    {% endif %}
+    {% if caveandentrance.entrance.map_description %}
+      <tr><td>Map</td><td colspan="9">{{ caveandentrance.entrance.map_description|safe }}</td></tr>
+    {% endif %}
+    {% if caveandentrance.entrance.approach %}
+      <tr><td>Approach</td><td colspan="9">{{ caveandentrance.entrance.approach|safe }}</td></tr>
+    {% endif %}
+    {% if caveandentrance.entrance.findability_description %}
+        <tr><th>Findability</th><td colspan="9">{{ caveandentrance.entrance.findability_description|safe }}</td></tr>
+    {% endif %}
+   {% if caveandentrance.entrance.marking_comment %}
+       <tr><th>Marking</th><td colspan="9">{{ caveandentrance.entrance.marking_comment|safe }}</td></tr>
+   {% endif %}
+   {% if cave.caveandentrance_set.all.0.entrance.entrance_description %}
+       <tr><th>Ent Desc</th><td colspan="9">{{ caveandentrance.entrance.entrance_description|safe }}</td></tr>
+   {% endif %}
    {% endfor %}
   {% endif %}
  {% endfor %}
diff --git a/urls.py b/urls.py
index 106195d..fb2f698 100644
--- a/urls.py
+++ b/urls.py
@@ -139,6 +139,8 @@ actualurlpatterns = patterns('',
     
     (r'^photos/(?P<path>.*)$', 'django.views.static.serve',
         {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
+        
+    url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
 
 #    (r'^gallery/(?P<path>.*)$', 'django.views.static.serve',
  #       {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),