[svn r7406] Lots of improvements to the prospecting guide
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 191 KiB |
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 113 KiB |
BIN
noinfo/prospecting_guide_76area.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
@ -7,4 +7,4 @@
|
||||
(36200.00, 82925.00, 50) 178 # Calculated from bearings
|
||||
(35232.64, 82910.37, 25) 181 # Calculated from bearings
|
||||
(35800.00, 83418.00, 100) 98 # "up from 176"
|
||||
(36086.00, 82723.00, 50) 1987-02 # "100m up from 157 and 0/5"
|
||||
(36086.00, 82723.00, 50) 1987-02 # "100m up from 157 and 0/5"
|
||||
|
@ -4,16 +4,16 @@
|
||||
areas = ['', '1a','1b','1c','1d', '2a', '2b', '2c', '2d', '3', '4', '5', '6','7', '8a', '8b', '8c', '8d', '9', '10', '11']
|
||||
|
||||
areanames = {
|
||||
'': 'Location unclear',
|
||||
'1a': '1a – Plateau: around Top Camp',
|
||||
'1b': '1b – Western plateau near 182',
|
||||
'1c': '1c – Eastern plateau near 204 walk-in path',
|
||||
'1d': '1d – Further plateau around 76',
|
||||
'2a': '2a – Southern Schwarzmooskogel near 201 path and the Nipple',
|
||||
'2b': '2b – Eishöhle area',
|
||||
'2c': '2c – Kaninchenhöhle area',
|
||||
'2d': '2d – Steinbrückenhöhle area',
|
||||
'3': '3 – Bräuning Alm',
|
||||
'': 'Location unclear',
|
||||
'1a': '1a – Plateau: around Top Camp',
|
||||
'1b': '1b – Western plateau near 182',
|
||||
'1c': '1c – Eastern plateau near 204 walk-in path',
|
||||
'1d': '1d – Further plateau around 76',
|
||||
'2a': '2a – Southern Schwarzmooskogel near 201 path and the Nipple',
|
||||
'2b': '2b – Eishöhle area',
|
||||
'2c': '2c – Kaninchenhöhle area',
|
||||
'2d': '2d – Steinbrückenhöhle area',
|
||||
'3': '3 – Bräuning Alm',
|
||||
'4': '4 – Kratzer valley',
|
||||
'5': '5 – Schwarzmoos-Wildensee',
|
||||
'6': '6 – Far plateau',
|
||||
@ -48,6 +48,7 @@ for a in areas: cavelists[a]=[]
|
||||
|
||||
|
||||
def chomp(s):
|
||||
if not s: return s
|
||||
if(s[-1]=="\n"): return s[:-1]
|
||||
else: return s
|
||||
|
||||
@ -71,11 +72,73 @@ def find_location(cave):
|
||||
return positions[cave[fixtype]]
|
||||
return 0
|
||||
|
||||
|
||||
def munge_allposline(line):
|
||||
x, y, z, name = re.match(r'\(([0-9.]*?),\s*([0-9.]*?),\s*([0-9.]*?)\s*\)\s*(.*)\n', line).groups()
|
||||
x,y, z = map(float, [x,y,z])
|
||||
return (name, x,y,z)
|
||||
|
||||
def is_explored(cave):
|
||||
s = cave["Kat Status Code"]
|
||||
if(not s): return "<td></td>"
|
||||
s = s.replace("(?)","")
|
||||
if s[-1] == " ": s=s[:-1]
|
||||
if (not s):
|
||||
print "Rogue space in " + find_effective_number(cave)
|
||||
return "<td></td>"
|
||||
code = s[-1]
|
||||
if code == '+': status = "good"
|
||||
elif code in ['=', 'x']: status = "bad"
|
||||
elif code in ['-', '?']: status = "awful"
|
||||
else: return "<td>%s</td>" % code
|
||||
return "<td class=\"%s\">%s</td>" % (status, code)
|
||||
|
||||
def is_tagged(cave):
|
||||
s = chomp(cave["Marking"])
|
||||
s = re.sub(r'\s+(?:\(\?\))?$', "", s)
|
||||
if not s and cave["Multiple entrances"] in ["yes", "entrance", "last entrance"]:
|
||||
return "<td></td>"
|
||||
if s == "Tag": return "<td class=\"good\">%s</td>" % s
|
||||
if s in ["Retag", "Paint", "Spit"]: return "<td class=\"bad\">%s</td>" % s
|
||||
if s == "Unmarked": return "<td class=\"awful\">None</td>"
|
||||
if s == "": return "<td class=\"awful\"></td>"
|
||||
print "Unrecognised marking status on %s: %s" % (find_effective_number(cave), repr(s))
|
||||
return "<td>ERROR</td>"
|
||||
|
||||
def findability_color(cave):
|
||||
if cave["Findability"] == "Surveyed": return "good"
|
||||
elif cave["Findability"] == "Refindable": return "bad"
|
||||
elif cave["Findability"] == "Lost": return "awful"
|
||||
else: return ""
|
||||
|
||||
def is_underground_surveyed(cave):
|
||||
s = chomp(cave["Underground drawn survey"])
|
||||
if(cave["Multiple entrances"] not in ["", "yes"]): return "<td></td>"
|
||||
if not s:
|
||||
return "<td class=\"awful\">None</td>"
|
||||
if s and (s.find("<img") > -1 or s.find("<a") > -1):
|
||||
return "<td class=\"good\">Yes</td>"
|
||||
else:
|
||||
return "<td class=\"bad\">Missing</td>"
|
||||
|
||||
def have_survey_data(cave):
|
||||
if(cave["Multiple entrances"] not in ["", "yes"]): return "<td></td>"
|
||||
s = chomp(cave["Survex file to get length and depth"])
|
||||
if s: return "<td class=\"good\">Yes</td>"
|
||||
s = chomp(cave["Underground drawn survey"])
|
||||
if s: return "<td class=\"bad\">Missing</td>"
|
||||
if cave["Kat Status Code"] and cave["Kat Status Code"][0] == '1':
|
||||
# Cave < 50m deep and < 50m long...
|
||||
# Sadly this band includes caves we really ought to have data for as
|
||||
# well as caves small enough that a grade 1 sketch is justifiable.
|
||||
return "<td class=\"bad\"><small>None, <50m</small></td>"
|
||||
return "<td class=\"awful\">None</td>"
|
||||
|
||||
def has_photo(cave):
|
||||
s = chomp(cave["Photo of location"])
|
||||
if ((cave["Multiple entrances"] not in ["", "yes"]) and chomp(cave["Autogen file"]) == ""):
|
||||
return "<td></td>"
|
||||
if not s:
|
||||
return "<td class=\"awful\">None</td>"
|
||||
if s and (s.find("<img") > -1 or s.find("<a") > -1):
|
||||
return "<td class=\"good\">Yes</td>"
|
||||
else:
|
||||
return "<td class=\"bad\">Missing</td>"
|
||||
|
||||
def find_label(cave, number):
|
||||
t = longnumber(cave, number) + " "
|
||||
@ -87,63 +150,94 @@ def find_label(cave, number):
|
||||
if(n[-1] in string.lowercase): n = n[:-1]
|
||||
except:
|
||||
n = "NONE"
|
||||
if(lengths.has_key(n)): t += (" %sm long %sm deep" % (lengths[n][0], lengths[n][1]))
|
||||
if lengths.has_key(n):
|
||||
t += (" %sm long %sm deep" % (lengths[n][0], lengths[n][1]))
|
||||
return t
|
||||
|
||||
def get_img_name(maparea):
|
||||
filename = "prospecting_guide"
|
||||
if maparea != "all":
|
||||
filename += "_" + maparea + "area"
|
||||
filename += ".jpg"
|
||||
return filename
|
||||
|
||||
# Parameters for big map
|
||||
# Parameters for big map and zoomed subarea maps:
|
||||
# height and width for subareas are calculated automatically from the
|
||||
# coordinates and the zoom factor
|
||||
|
||||
MAP_LEFT_GK = 34394.9
|
||||
MAP_TOP_GK = 84508.6
|
||||
MAP_RIGHT_GK = 37399.4
|
||||
MAP_BOTTOM_GK = 80895.6
|
||||
MAP_WIDTH = 1417
|
||||
MAP_HEIGHT = 1704
|
||||
maps = {
|
||||
# id left top right bottom width height zoom
|
||||
# G&K G&K G&K G&K pixels pixels (times)
|
||||
"all": [34394.9, 84508.6, 37399.4, 80895.6, 1417, 1704, 1.0,
|
||||
"All"],
|
||||
"40": [36275.6, 82392.5, 36780.3, 81800.0, 0, 0, 3.0,
|
||||
"Eishöhle"],
|
||||
"76": [35440.0, 83320.0, 36090.0, 82770.0, 0, 0, 3.0,
|
||||
"Eislufthöhle"],
|
||||
"204": [36354.1, 84154.5, 37047.4, 83399.7, 0, 0, 3.0,
|
||||
"Steinbrückenhöhle"],
|
||||
"tc": [35230.0, 82790.0, 36110.0, 82200.0, 0, 0, 3.0,
|
||||
"Near Top Camp"],
|
||||
}
|
||||
# Keys in the order in which we want the maps output
|
||||
mapcodes = ["all", "40", "76", "204", "tc"]
|
||||
# Field codes
|
||||
L = 0
|
||||
T = 1
|
||||
R = 2
|
||||
B = 3
|
||||
W = 4
|
||||
H = 5
|
||||
Z = 6
|
||||
D = 7
|
||||
|
||||
# Parameters for zoomed smaller maps
|
||||
|
||||
MAP40_LEFT_GK = 36275.6
|
||||
MAP40_TOP_GK = 82392.5
|
||||
MAP40_RIGHT_GK = 36780.3
|
||||
MAP40_BOTTOM_GK = 81601.7
|
||||
MAP40_WIDTH = 714
|
||||
MAP40_HEIGHT = 1119
|
||||
|
||||
MAP204_LEFT_GK = 36354.1
|
||||
MAP204_TOP_GK = 84154.5
|
||||
MAP204_RIGHT_GK = 37047.4
|
||||
MAP204_BOTTOM_GK = 83399.7
|
||||
MAP204_WIDTH = 972
|
||||
MAP204_HEIGHT = 1068
|
||||
|
||||
import Image, ImageDraw, ImageFont, string, os
|
||||
myImage = Image.open("pguidemap.jpg")
|
||||
myDraw = ImageDraw.Draw(myImage)
|
||||
my40Image = myImage.crop(map(int, (
|
||||
(MAP40_LEFT_GK - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH,
|
||||
(MAP40_TOP_GK - MAP_TOP_GK)/-(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT,
|
||||
(MAP40_RIGHT_GK - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH,
|
||||
(MAP40_BOTTOM_GK - MAP_TOP_GK)/-(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT)))
|
||||
my40Image = my40Image.resize((MAP40_WIDTH, MAP40_HEIGHT), Image.BICUBIC)
|
||||
my40Draw = ImageDraw.Draw(my40Image)
|
||||
my204Image = myImage.crop(map(int, (
|
||||
(MAP204_LEFT_GK - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH,
|
||||
(MAP204_TOP_GK - MAP_TOP_GK)/-(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT,
|
||||
(MAP204_RIGHT_GK - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH,
|
||||
(MAP204_BOTTOM_GK - MAP_TOP_GK)/-(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT)))
|
||||
my204Image = my204Image.resize((MAP204_WIDTH, MAP204_HEIGHT), Image.BICUBIC)
|
||||
my204Draw = ImageDraw.Draw(my204Image)
|
||||
|
||||
#FONT = "/usr/X11R6/lib/X11/fonts/truetype/arial.ttf"
|
||||
#FONT = "C:\WINNT\Fonts\ARIAL.TTF"
|
||||
FONT = "/usr/share/fonts/truetype/freefont/FreeSans.ttf"
|
||||
import Image, ImageDraw, ImageFont, string, os, sys
|
||||
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
|
||||
SIZE = 8
|
||||
myFont = ImageFont.truetype(FONT, SIZE)
|
||||
myDraw.setfont(myFont)
|
||||
my40Draw.setfont(myFont)
|
||||
my204Draw.setfont(myFont)
|
||||
|
||||
def mungecoord(x, y, mapcode = ""):
|
||||
M = maps["all"]
|
||||
mainImage = Image.open("pguidemap.jpg")
|
||||
#mainImage = Image.new("RGB", (M[W], M[H]), '#ffffff')
|
||||
|
||||
imgs = {}
|
||||
draws = {}
|
||||
imgmaps = {}
|
||||
for maparea in maps.keys():
|
||||
m = maps[maparea]
|
||||
if maparea == "all":
|
||||
img = mainImage
|
||||
else:
|
||||
l = int((m[L] - M[L]) / (M[R] - M[L]) * M[W])
|
||||
t = int((m[T] - M[T]) / (M[B] - M[T]) * M[H])
|
||||
r = int((m[R] - M[L]) / (M[R] - M[L]) * M[W])
|
||||
b = int((m[B] - M[T]) / (M[B] - M[T]) * M[H])
|
||||
img = mainImage.crop((l, t, r, b))
|
||||
w = int(round(m[Z] * (m[R] - m[L]) / (M[R] - M[L]) * M[W]))
|
||||
h = int(round(m[Z] * (m[B] - m[T]) / (M[B] - M[T]) * M[H]))
|
||||
print "%s: H %d W %d" % (maparea, h, w)
|
||||
img = img.resize((w, h), Image.BICUBIC)
|
||||
maps[maparea][H] = h
|
||||
maps[maparea][W] = w
|
||||
imgs[maparea] = img
|
||||
draw = ImageDraw.Draw(img)
|
||||
draw.setfont(myFont)
|
||||
draws[maparea] = draw
|
||||
imgmaps[maparea] = []
|
||||
# Draw scale bar
|
||||
m100 = int(100 / (m[R] - m[L]) * m[W])
|
||||
draw.line([10, SIZE*3, 10, SIZE*2], fill='#000000')
|
||||
draw.line([10, SIZE*2, 10+m100, SIZE*2], fill='#000000')
|
||||
draw.line([10+m100, SIZE * 3, 10+m100, SIZE*2], fill='#000000')
|
||||
label = "100m"
|
||||
draw.text([10 + (m100 - draw.textsize(label)[0]) / 2, SIZE/2], label, fill='#000000')
|
||||
|
||||
def mungecoord(x, y, mapcode):
|
||||
# Top of Zinken is 73 1201 = dataset 34542 81967
|
||||
# Top of Hinter is 1073 562 = dataset 36670 83317
|
||||
# image is 1417 by 2201
|
||||
@ -157,40 +251,20 @@ def mungecoord(x, y, mapcode = ""):
|
||||
# yoffset = (y - 83317)*FACTOR
|
||||
# return (1073 + xoffset, 562 - yoffset)
|
||||
|
||||
if(mapcode == "40"):
|
||||
return (x - MAP40_LEFT_GK)/(MAP40_RIGHT_GK - MAP40_LEFT_GK) * MAP40_WIDTH, MAP40_HEIGHT - (y - MAP40_BOTTOM_GK)/(MAP40_TOP_GK - MAP40_BOTTOM_GK) * MAP40_HEIGHT
|
||||
elif(mapcode == "204"):
|
||||
return (x - MAP204_LEFT_GK)/(MAP204_RIGHT_GK - MAP204_LEFT_GK) * MAP204_WIDTH, MAP204_HEIGHT - (y - MAP204_BOTTOM_GK)/(MAP204_TOP_GK - MAP204_BOTTOM_GK) * MAP204_HEIGHT
|
||||
else:
|
||||
return (x - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH, MAP_HEIGHT - (y - MAP_BOTTOM_GK)/(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT
|
||||
|
||||
m = maps[mapcode]
|
||||
return (x - m[L]) / (m[R] - m[L]) * m[W], (m[T] - y) / (m[T] - m[B]) * m[H]
|
||||
|
||||
|
||||
def plot(loctuple, number, area, label):
|
||||
shortnumber = number.replace("—","")
|
||||
(x,y) = map(int, mungecoord(loctuple[0], loctuple[1]))
|
||||
x = int(x)
|
||||
y = int(y)
|
||||
imagemap_areas.append( [x-4, y-SIZE/2, x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
|
||||
myDraw.rectangle([(x+4, y-SIZE/2), (x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2)], fill="#ffffff")
|
||||
myDraw.text((x+6,y-SIZE/2), shortnumber, fill="#000000")
|
||||
myDraw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
|
||||
(x,y) = mungecoord(loctuple[0], loctuple[1], "40")
|
||||
x = int(x)
|
||||
y = int(y)
|
||||
imagemap40_areas.append( [x-4, y-SIZE/2, x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
|
||||
my40Draw.rectangle([(x+4, y-SIZE/2), (x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2)], fill="#ffffff")
|
||||
my40Draw.text((x+6,y-SIZE/2), shortnumber, fill="#000000")
|
||||
my40Draw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
|
||||
(x,y) = mungecoord(loctuple[0], loctuple[1], "204")
|
||||
x = int(x)
|
||||
y = int(y)
|
||||
imagemap204_areas.append( [x-4, y-SIZE/2, x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
|
||||
my204Draw.rectangle([(x+4, y-SIZE/2), (x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2)], fill="#ffffff")
|
||||
my204Draw.text((x+6,y-SIZE/2), shortnumber, fill="#000000")
|
||||
my204Draw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
for maparea in maps.keys():
|
||||
(x,y) = map(int, mungecoord(loctuple[0], loctuple[1], maparea))
|
||||
draw = draws[maparea]
|
||||
imgmaps[maparea].append( [x-4, y-SIZE/2, x+4+draw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
|
||||
draw.rectangle([(x+4, y-SIZE/2), (x+4+draw.textsize(shortnumber)[0], y+SIZE/2)], fill="#ffffff")
|
||||
draw.text((x+6,y-SIZE/2), shortnumber, fill="#000000")
|
||||
draw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
|
||||
def writeout_imagemap(data, mapname):
|
||||
# Munge the list of coordinates into a proper image map.
|
||||
@ -213,14 +287,6 @@ cavetabfile = file("../CAVETAB2.CSV")
|
||||
fieldnames=chomp(cavetabfile.next()).replace('"','').split(",")
|
||||
cavetab = csv.DictReader(cavetabfile, fieldnames)
|
||||
|
||||
positionfile = file("../all.pos")
|
||||
positionfile.next()
|
||||
positions = {}
|
||||
print "Munging all.pos"
|
||||
for stn in positionfile:
|
||||
t = munge_allposline(stn)
|
||||
positions[t[0]] = (t[1],t[2],t[3])
|
||||
print "Done"
|
||||
print "Munging lengths.dat"
|
||||
lengthsfile = file("lengths.dat")
|
||||
lengths = {}
|
||||
@ -230,27 +296,43 @@ for l in lengthsfile:
|
||||
print "Done"
|
||||
|
||||
# Draw cave passage
|
||||
for mapcode in ["", "40", "204"]:
|
||||
file3d = os.popen("/home/olly/cvs/survex-1.1/src/dump3d ../all.3d")
|
||||
if mapcode == "40":
|
||||
thisDraw = my40Draw
|
||||
elif mapcode == "204":
|
||||
thisDraw = my204Draw
|
||||
else:
|
||||
thisDraw = myDraw
|
||||
lastx, lasty = 0, 0
|
||||
for l in file3d:
|
||||
try:
|
||||
act,E,N,flags = re.match(r'^(MOVE|LINE)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(?:.*\] ([^]]*)$)?', l).groups()
|
||||
except:
|
||||
continue
|
||||
if not flags: flags = ""
|
||||
E,N = map(float, (E,N))
|
||||
x,y = map(int, mungecoord(E, N, mapcode))
|
||||
print "Munging dump3d output"
|
||||
positions = {}
|
||||
surfacecolour = "#808080"
|
||||
repath = re.compile(r'^(?:182to(?:tc|184)|tctocol|82to97|vd1to161d|161ftod|161etof|161etog|40entlink2|surfnr161|surf161|kansurf)$')
|
||||
for fnm in ("all.3d", "alltracks.3d"):
|
||||
for mapcode in draws.keys():
|
||||
file3d = os.popen("dump3d ../" + fnm)
|
||||
draw = draws[mapcode]
|
||||
lastx, lasty = 0, 0
|
||||
for l in file3d:
|
||||
match = re.match(r'^(MOVE|LINE|NODE)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(?:[^[]*\[(.*)\] ?([^]]*)$)?', l)
|
||||
if not match: continue
|
||||
|
||||
act,E,N,alt,name,flags = match.groups()
|
||||
# Only need to process NODEs once
|
||||
if act == "NODE" and mapcode != "all": continue
|
||||
|
||||
if act == "LINE" and not re.match(r'\bSURFACE\b', flags):
|
||||
thisDraw.line([lastx, lasty, x, y], fill="#800080")
|
||||
lastx,lasty = x,y
|
||||
if not flags: flags = ""
|
||||
E,N = map(float, (E,N))
|
||||
if act == "NODE":
|
||||
positions[name] = (E,N,float(alt))
|
||||
continue
|
||||
|
||||
x,y = map(int, mungecoord(E, N, mapcode))
|
||||
|
||||
if act == "LINE":
|
||||
if re.match(r'\bSURFACE\b', flags):
|
||||
if re.match(repath, name):
|
||||
draw.line([lastx, lasty, x, y], fill='#008000')
|
||||
else:
|
||||
draw.line([lastx, lasty, x, y], fill='#808080')
|
||||
else:
|
||||
draw.line([lastx, lasty, x, y], fill="#800080")
|
||||
lastx,lasty = x,y
|
||||
surfacecolour = "#008000"
|
||||
repath = re.compile(r'^')
|
||||
print "Done"
|
||||
|
||||
cavestoplot = []
|
||||
for cave in cavetab:
|
||||
@ -275,17 +357,13 @@ for cave in cavetab:
|
||||
|
||||
loctuple = find_location(cave)
|
||||
label = find_label(cave, shortnumber)
|
||||
#print label
|
||||
if(cave["Multiple entrances"] == "yes"):
|
||||
locn = "<td colspan=\"3\"> </td>"
|
||||
elif(loctuple):
|
||||
locn = "<td>%d</td><td>%d</td><td>%d</td>" % loctuple
|
||||
locn = "<td class=\"locn good\">%d</td><td class=\"locn good\">%d</td><td class=\"locn good\">%d</td>" % loctuple
|
||||
cavestoplot.append((loctuple, number, area, label))
|
||||
else:
|
||||
findability = cave["Findability"]
|
||||
if not findability:
|
||||
findability = '?'
|
||||
locn = "<td colspan=\"3\">" + findability + "</td>"
|
||||
locn = "<td colspan=\"3\" class=%s>" % findability_color(cave) + (cave["Findability"] or '?') + "</td>"
|
||||
try:
|
||||
cavelists[area].append((number, cave, locn))
|
||||
except:
|
||||
@ -294,31 +372,43 @@ for cave in cavetab:
|
||||
htmlfile = file("../prospecting_guide.html", "w")
|
||||
|
||||
htmlfile.write("<html><head><title>Prospecting Guide</title>\n")
|
||||
htmlfile.write("<style type=\"text/css\">.locn { font-size: x-small }</style></head>\n")
|
||||
htmlfile.write("""
|
||||
<style type="text/css">
|
||||
.locn { font-size: x-small }
|
||||
.bad { background-color: #ff9955; text-align: center }
|
||||
.good { background-color: #99ff99; text-align: center }
|
||||
.awful { background-color: #ff5555; text-align: center }
|
||||
</style></head>""")
|
||||
htmlfile.write("<body><h1>Prospecting Guide</h1>")
|
||||
htmlfile.write("<p>Generated " + time.strftime("%x %X") + "</p>\n")
|
||||
htmlfile.write("<p><b>Notes:</b></p><ul><li>A marking status of \"Retag\" means a tag is in place but it carries a provisional number, or in some cases an incorrect number, and needs replacing with a new tag.</li>\n<li>Kataster status codes indicate the size of a cave, its character and its exploration status, as described <a href=\"../katast.htm\">here</a>.</li><li>For more info on each cave, see the links to detailed description pages.</li></ul><p><img src=\"prospecting_guide.jpg\" usemap=\"#map1\" ismap=\"ismap\" /></p><h3 id=\"idsubmap40\">Eishöhle area detail</h3><p><img src=\"prospecting_guide_40area.jpg\" usemap=\"#map40\" ismap=\"ismap\" /></p><h3 id=\"idsubmap204\">Steinbrückenhöhle area detail</h3><p><img src=\"prospecting_guide_204area.jpg\" usemap=\"#map204\" ismap=\"ismap\" /></p>\n")
|
||||
htmlfile.write("<p><small>Generated " + time.strftime("%x %X") + " by " + sys.argv[0] + "</small></p>\n")
|
||||
htmlfile.write("<p><b>Notes:</b></p><ul><li>A marking status of \"Retag\" means a tag is in place but it carries a provisional number, or in some cases an incorrect number, and needs replacing with a new tag.</li>\n<li>Kataster status codes indicate the size of a cave, its character and its exploration status, as described <a href=\"../katast.htm\">here</a>.</li><li>For more info on each cave, see the links to detailed description pages.</li></ul>\n")
|
||||
|
||||
for maparea in mapcodes:
|
||||
filename = get_img_name(maparea)
|
||||
if maparea != "all":
|
||||
htmlfile.write("<h3 id=\"idsubmap%s\">%s area detail</h3>\n" % (maparea, maps[maparea][D]))
|
||||
htmlfile.write("<p><img src=\"%s\" usemap=\"#map%s\" ismap=\"ismap\" /></p>\n" % (filename, maparea))
|
||||
|
||||
cachednumber = ""
|
||||
cachedarea = ""
|
||||
cachedname = ""
|
||||
imagemap_areas=[]
|
||||
imagemap40_areas=[]
|
||||
imagemap204_areas=[]
|
||||
|
||||
# Plot the subareas on the full map
|
||||
(t,l) = mungecoord(MAP40_LEFT_GK, MAP40_TOP_GK)
|
||||
(b,r) = mungecoord(MAP40_RIGHT_GK, MAP40_BOTTOM_GK)
|
||||
myDraw.rectangle([t, l, b, r], outline='#777777')
|
||||
myDraw.rectangle([t, l, t+8, l+8], fill='#777777')
|
||||
imagemap_areas.append( [t, l, t+8, l+8, "submap40", "1623/40 subarea map"] )
|
||||
|
||||
(t,l) = mungecoord(MAP204_LEFT_GK, MAP204_TOP_GK)
|
||||
(b,r) = mungecoord(MAP204_RIGHT_GK, MAP204_BOTTOM_GK)
|
||||
myDraw.rectangle([t, l, b, r], outline='#777777')
|
||||
myDraw.rectangle([t, l, t+8, l+8], fill='#777777')
|
||||
imagemap_areas.append( [t, l, t+8, l+8, "submap204", "1623/204 subarea map"] )
|
||||
|
||||
for maparea in maps.keys():
|
||||
if maparea == "all":
|
||||
continue
|
||||
m = maps[maparea]
|
||||
l,t = mungecoord(m[L], m[T], "all")
|
||||
r,b = mungecoord(m[R], m[B], "all")
|
||||
text = maparea + " map"
|
||||
textlen = draws['all'].textsize(text)[0] + 3
|
||||
draws['all'].rectangle([l, t, l+textlen, t+SIZE+2], fill='#ffffff')
|
||||
draws['all'].text((l+2, t+1), text, fill="#000000")
|
||||
imgmaps['all'].append( [l, t, l+textlen, t+SIZE+2, "submap" + maparea, maparea + " subarea map"] )
|
||||
# draws['all'].rectangle([l, t, l+8, t+8], fill='#777777')
|
||||
# imgmaps['all'].append( [l, t, l+8, t+8, "submap" + maparea, maparea + " subarea map"] )
|
||||
draws['all'].rectangle([l, t, r, b], outline='#777777')
|
||||
draws['all'].rectangle([l, t, l+textlen, t+SIZE+2], outline='#777777')
|
||||
|
||||
# Plot faked positions first so that real caves go on top of the large circles
|
||||
fakedpositions = file("fakedpositions.dat")
|
||||
@ -342,18 +432,18 @@ for p in fakedpositions:
|
||||
break
|
||||
|
||||
(x,y,d) = map(float, (x,y,d))
|
||||
(x,y,d) = map(round, (x,y,d))
|
||||
lo = mungecoord(x-d,y+d)
|
||||
hi = mungecoord(x+d,y-d)
|
||||
foo = mungecoord(x-d, y)
|
||||
myDraw.ellipse([lo,hi], outline="#000000")
|
||||
myDraw.ellipse([lo[0]+1, lo[1]+1,hi[0]-1, hi[1]-1], outline=areacolours[area])
|
||||
myDraw.ellipse([lo[0]+2, lo[1]+2,hi[0]-2, hi[1]-2], outline=areacolours[area])
|
||||
myDraw.rectangle([foo[0],foo[1]-SIZE/2, foo[0] + myDraw.textsize(name)[0], foo[1]+SIZE/2], fill="#ffffff")
|
||||
imagemap_areas.append( [foo[0],foo[1]-SIZE/2, foo[0] + myDraw.textsize(name)[0], foo[1]+SIZE/2, name, "Approx position of %s" % name] )
|
||||
|
||||
myDraw.text((foo[0], foo[1]-SIZE/2), name, fill="#000000")
|
||||
for maparea in maps.keys():
|
||||
lo = mungecoord(x-d, y+d, maparea)
|
||||
hi = mungecoord(x+d, y-d, maparea)
|
||||
lpos = mungecoord(x-d, y, maparea)
|
||||
draw = draws[maparea]
|
||||
draw.ellipse([lo,hi], outline="#000000")
|
||||
draw.ellipse([lo[0]+1, lo[1]+1,hi[0]-1, hi[1]-1], outline=areacolours[area])
|
||||
draw.ellipse([lo[0]+2, lo[1]+2,hi[0]-2, hi[1]-2], outline=areacolours[area])
|
||||
draw.rectangle([lpos[0],lpos[1]-SIZE/2, lpos[0] + draw.textsize(name)[0], lpos[1]+SIZE/2], fill="#ffffff")
|
||||
imgmaps[maparea].append( [lpos[0],lpos[1]-SIZE/2, lpos[0] + draw.textsize(name)[0], lpos[1]+SIZE/2, name, "Approx position of %s" % name] )
|
||||
|
||||
draw.text((lpos[0], lpos[1]-SIZE/2), name, fill="#000000")
|
||||
|
||||
plot(positions["laser.0_7"], "BNase", "6", "Bräuning Näse laser point")
|
||||
plot(positions["226-96"], "BZkn", "6", "Bräuning Zinken trig point")
|
||||
@ -362,6 +452,7 @@ plot(positions["laser.kt114_96"],"HSK","6", "Hinterer Schwarzmooskogel trig poin
|
||||
plot(positions["2000"],"Nipple","6", "Nipple (Weiße Warze)")
|
||||
plot(positions["3000"],"VSK","6", "Vorderer Schwarzmooskogel summit")
|
||||
plot(positions["topcamp"], "TC", "6", "Top Camp")
|
||||
plot(positions["laser.0"], "LSR0", "6", "Laser Point 0")
|
||||
plot(positions["laser.0_1"], "LSR1", "6", "Laser Point 0/1")
|
||||
plot(positions["laser.0_5"], "LSR5", "6", "Laser Point 0/5")
|
||||
|
||||
@ -376,34 +467,37 @@ for area in areas:
|
||||
htmlfile.write("<h3><span style=\"background-color: %s; border: 1px solid black\"> </span> %s</h3>" % (areacolours.get(area, "#ffffff"), areanames[area]))
|
||||
else:
|
||||
htmlfile.write("<h3>Location unclear</h3>")
|
||||
htmlfile.write("<table border=\"1\">\n<tr><th>Cave Number</th><th>Name</th><th>E</th><th>N</th><th>Alt</th><th>Marking</th><th>Status</th>")
|
||||
htmlfile.write("<table border=\"1\">\n")
|
||||
htmlfile.write("<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>E</th><th>N</th><th>Alt</th><th>Location</th>")
|
||||
|
||||
for (number, cave, locn) in cavelists[area]:
|
||||
if cave["Autogen file"]:
|
||||
htmlfile.write("<tr><td><a href=\"../%s\">%s</a></td><td><a id=\"id%s\">%s</a></td>" % (cave["Autogen file"], longnumber(cave, number), number.replace("—", ""), cave["Name"] or cave["Unofficial Name"]))
|
||||
else:
|
||||
htmlfile.write("<tr><td>%s</td><td><a id=\"id%s\">%s</a></td>" % (longnumber(cave, number), number.replace("—", ""), cave["Name"] or cave["Unofficial Name"]))
|
||||
htmlfile.write(locn + "<td>%s</td><td>%s</td>" % (cave["Marking"], cave["Kat Status Code"]))
|
||||
|
||||
htmlfile.write(is_explored(cave))
|
||||
htmlfile.write(have_survey_data(cave))
|
||||
htmlfile.write(is_underground_surveyed(cave))
|
||||
htmlfile.write(is_tagged(cave))
|
||||
htmlfile.write(has_photo(cave))
|
||||
|
||||
htmlfile.write(locn)
|
||||
if(cave["Findability"] != "Surveyed" and cave["Multiple entrances"] != "yes"):
|
||||
htmlfile.write("<td class=\"locn\">%s %s</td>" % (cave["Location"], cave["Bearings"]))
|
||||
htmlfile.write("</tr>\n")
|
||||
|
||||
htmlfile.write("</table>\n")
|
||||
|
||||
|
||||
writeout_imagemap(imagemap_areas, "map1")
|
||||
writeout_imagemap(imagemap40_areas, "map40")
|
||||
writeout_imagemap(imagemap204_areas, "map204")
|
||||
for maparea in imgmaps.keys():
|
||||
writeout_imagemap(imgmaps[maparea], "map" + maparea)
|
||||
|
||||
htmlfile.write("</body></html>")
|
||||
htmlfile.close()
|
||||
del myDraw
|
||||
del my40Draw
|
||||
del my204Draw
|
||||
myImage.save("../prospecting_guide.jpg", "JPEG")
|
||||
my40Image.save("../prospecting_guide_40area.jpg", "JPEG")
|
||||
my204Image.save("../prospecting_guide_204area.jpg", "JPEG")
|
||||
|
||||
|
||||
|
||||
for maparea in imgs.keys():
|
||||
del draws[maparea]
|
||||
filename = get_img_name(maparea)
|
||||
imgs[maparea].save("../" + filename, "JPEG")
|
||||
|
||||
# vim:syntax=python:set ts=4:
|
||||
|
Before Width: | Height: | Size: 708 KiB After Width: | Height: | Size: 682 KiB |
@ -24,7 +24,7 @@ areanames = {
|
||||
'8d': '8d – Loser-Hochganger ridge',
|
||||
'9': '9 – Gschwandt Alm',
|
||||
'10': '10 – Altaussee',
|
||||
'11': '11 – Augstbach',
|
||||
'11': '11 – Augstbach'
|
||||
}
|
||||
|
||||
areacolours = {
|
||||
@ -36,6 +36,7 @@ areacolours = {
|
||||
'2b' : '#00ff00',
|
||||
'2c' : '#008800',
|
||||
'2d' : '#ff9900',
|
||||
'3' : '#880000',
|
||||
'4' : '#0000ff',
|
||||
'6' : '#000000', # doubles for surface fixed pts
|
||||
'7' : '#808080'
|
||||
@ -47,23 +48,23 @@ for a in areas: cavelists[a]=[]
|
||||
|
||||
|
||||
def chomp(s):
|
||||
if not s: return s
|
||||
if not s: return s
|
||||
if s[-1]=="\n": return chomp(s[:-1])
|
||||
elif s[-1]==" ": return chomp(s[:-1])
|
||||
else: return s
|
||||
else: return s
|
||||
|
||||
def find_effective_number(c):
|
||||
"""Determine an appropriate number to use."""
|
||||
if c["Kataster Number"]:
|
||||
return c["Kataster Number"]
|
||||
else:
|
||||
return c["Unofficial number"]
|
||||
"""Determine an appropriate number to use."""
|
||||
if c["Kataster Number"]:
|
||||
return c["Kataster Number"]
|
||||
else:
|
||||
return c["Unofficial number"]
|
||||
|
||||
def longnumber(c, number):
|
||||
"""Both numbers"""
|
||||
if (c["Unofficial number"] and c["Unofficial number"] != number):
|
||||
return number + " (" + c["Unofficial number"] + ")"
|
||||
else:
|
||||
"""Both numbers"""
|
||||
if (c["Unofficial number"] and c["Unofficial number"] != number):
|
||||
return number + " (" + c["Unofficial number"] + ")"
|
||||
else:
|
||||
return number
|
||||
|
||||
def find_location(cave):
|
||||
@ -72,6 +73,7 @@ def find_location(cave):
|
||||
return positions[cave[fixtype]]
|
||||
return 0
|
||||
|
||||
|
||||
def munge_allposline(line):
|
||||
x, y, z, name = re.match(r'\(([0-9.]*?),\s*([0-9.]*?),\s*([0-9.]*?)\s*\)\s*(.*)\n', line).groups()
|
||||
x,y, z = map(float, [x,y,z])
|
||||
@ -127,6 +129,7 @@ import csv, re, time
|
||||
cavetabfile = file("../CAVETAB2.CSV")
|
||||
fieldnames=chomp(cavetabfile.next()).replace('"','').split(",")
|
||||
cavetab = csv.DictReader(cavetabfile, fieldnames)
|
||||
|
||||
positionfile = file("../all.pos")
|
||||
positionfile.next()
|
||||
positions = {}
|
||||
@ -169,19 +172,22 @@ for cave in cavetab:
|
||||
cachedarea = cave["Area"]
|
||||
|
||||
area = cave["Area"]
|
||||
if area == '1626': continue
|
||||
|
||||
# We have some areas like '2b or 4 (unclear)' - just chop the space
|
||||
# and everything after it for these.
|
||||
area = re.sub(r' .*', "", area)
|
||||
if area == '1626' or area == 'nonexistent': continue
|
||||
|
||||
loctuple = find_location(cave)
|
||||
if(cave["Multiple entrances"] == "yes"):
|
||||
locn = "<td colspan=\"3\"> </td>"
|
||||
elif(loctuple):
|
||||
locn = "<td class=\"locn good\">%d</td><td class=\"locn good\">%d</td><td class=\"locn good\">%d</td>" % loctuple
|
||||
else:
|
||||
locn = "<td colspan=\"3\" class=%s>" % findability_color(cave) + cave["Findability"] + "</td>"
|
||||
try:#if(not cavelists.has_key(area)): cavelists[area]=[]
|
||||
locn = "<td colspan=\"3\" class=%s>" % findability_color(cave) + (cave["Findability"] or '?') + "</td>"
|
||||
try:
|
||||
cavelists[area].append((number, cave, locn))
|
||||
except:
|
||||
print number, area
|
||||
print "Bad area '%s' for cave %s" % (area, number)
|
||||
|
||||
for area in areas:
|
||||
if area:
|
||||
@ -200,7 +206,7 @@ for area in areas:
|
||||
htmlfile.write(is_underground_surveyed(cave))
|
||||
htmlfile.write(is_tagged(cave))
|
||||
htmlfile.write(has_photo(cave))
|
||||
|
||||
|
||||
htmlfile.write(locn)
|
||||
if(cave["Findability"] != "Surveyed" and cave["Multiple entrances"] != "yes"):
|
||||
htmlfile.write("<td class=\"locn\">%s %s</td>" % (cave["Location"], cave["Bearings"]))
|
||||
|
BIN
noinfo/prospecting_guide_tcarea.jpg
Normal file
After Width: | Height: | Size: 177 KiB |