From a4edfca30e254aa5135a059870ebd60219874087 Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Wed, 13 May 2009 05:59:40 +0100 Subject: [svn] Got QM pages working. Started scripts for exporting to old expo format. Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8269 by aaron @ 3/12/2009 2:22 PM --- export/tocavetab.py | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 export/tocavetab.py (limited to 'export/tocavetab.py') diff --git a/export/tocavetab.py b/export/tocavetab.py new file mode 100644 index 0000000..5be866c --- /dev/null +++ b/export/tocavetab.py @@ -0,0 +1,79 @@ +import troggle.expo.models as models +from django.conf import settings + +import csv +import re +import os + +##format of CAVETAB2.CSV is +KatasterNumber = 0 +KatStatusCode = 1 +Entrances = 2 +UnofficialNumber = 3 +MultipleEntrances = 4 +AutogenFile = 5 +LinkFile = 6 +LinkEntrance = 7 +Name = 8 +UnofficialName = 9 +Comment = 10 +Area = 11 +Explorers = 12 +UndergroundDescription = 13 +Equipment = 14 +QMList = 15 +KatasterStatus = 16 +References = 17 +UndergroundCentreLine = 18 +UndergroundDrawnSurvey = 19 +SurvexFile = 20 +Length = 21 +Depth = 22 +Extent = 23 +Notes = 24 +EntranceName = 25 +TagPoint = 26 +OtherPoint = 27 +DescriptionOfOtherPoint = 28 +ExactEntrance = 29 +TypeOfFix = 30 +GPSpreSA = 31 +GPSpostSA = 32 +Northing = 33 +Easting = 34 +Altitude = 35 +Bearings = 36 +Map = 37 +Location = 38 +Approach = 39 +EntranceDescription = 40 +PhotoOfLocation = 41 +Marking = 42 +MarkingComment = 43 +Findability = 44 +FindabilityComment = 45 + +##format of CAVETAB2.CSV is +headers=['KatasterNumber','KatStatusCode','Entrances','UnofficialNumber','MultipleEntrances','AutogenFile','LinkFile','LinkEntrance','Name','UnofficialName', + 'Comment','Area','Explorers','UndergroundDescription','Equipment','QMList','KatasterStatus','References','UndergroundCentreLine','UndergroundDrawnSurvey', + 'SurvexFile','Length','Depth','Extent','Notes','EntranceName','TagPoint','OtherPoint','DescriptionOfOtherPoint','ExactEntrance','TypeOfFix','GPSpreSA', + 'GPSpostSA','Northing','Easting','Altitude','Bearings','Map','Location','Approach','EntranceDescription','PhotoOfLocation','Marking','MarkingComment', + 'Findability','FindabilityComment'] +headersDict={} +x=0 +for column in headers: + headersDict[x]=column + x+=1 +print headersDict + +def writeCaveTab(path): + outfile=file(path,'w') + cavewriter=csv.writer(outfile) + cavewriter.writerows + for cave in Cave.objects.all(): + caverow[KatasterNumber]=cave.kataster_number + caverow[KatStatusCode]=cave.katasternumber + +def addCell(caverow, attribute): + caverow[attribute]=cave.attribute + -- cgit v1.2.3