-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeocodeLotPlanV2.mb
More file actions
108 lines (87 loc) · 3.36 KB
/
Copy pathGeocodeLotPlanV2.mb
File metadata and controls
108 lines (87 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'================================================================================================================='
' Programmer: John Worrall '
' Last Update: 26/11/2012 '
' '
' Description: '
' - Geocode Lot Plan for Sound Division '
' '
' '
'================================================================================================================='
'Library
'*************************************************************
Include "mapbasic.def"
'*************************************************************
Declare Function StringCompareDCDB(ByVal DCDBTbl As String, ByVal LotPlan As String) As String 'Coordinate ' 1=found 2=not found
Declare Sub Main
Sub Main
'Read through Tables to compare
'Set Index
'Open Table "C:\Documents and Settings\jaworra\Desktop\delete\QLD_bpoly.tab" as DCDB
'Create Index on DCDB(Lot_plan)
'Commit Table DCDB
Close all
Print Chr$(12)
Dim SucLogFile,NotSucFile,ReadString,ReadLine,StringComp As String
Dim FirCol,SecCol As Integer
'Read through Tables to compare
Open Table "C:\Documents and Settings\jaworra\Desktop\Delete1\OUTPUT1.TAB" as DCDB
'Read input assign parse strings to compare
ReadString ="C:\Documents and Settings\jaworra\Desktop\Delete1\2DAdatabasegeocoding.csv"
'ReadString = FileOpenDlg("C:\TEMP\test","2DAdatabasegeocoding","csv","Table to Geocode")
Open File ReadString For Input As #1
'Store Results
SucLogFile = "C:\Documents and Settings\jaworra\Desktop\Delete1\SuccesLog.csv"
'SucLogFile = FileSaveAsDlg("","SuccesLog","csv","Save File")
Open File SucLogFile For Output As #2
NotSucFile = "C:\Documents and Settings\jaworra\Desktop\Delete1\NotFoundLog.csv"
'NotSucFile = FileSaveAsDlg("","NotFoundLog","csv","Not Found File")
Open File NotSucFile For Output As #3
Do While Not EOF(1)
Line Input #1,ReadLine
If Not EOF(1) Then
FirCol = InStr(1,ReadLine,"|")
'SecCol = InStr(FirCol+1,ReadLine,"|")
StringComp = Mid$(ReadLine, 1, FirCol-1)
' Excludes empty fields
If FirCol > 2 Then
Print StringComp +" Searching......"
'Output csv with successful returns
If StringCompareDCDB(DCDB,StringComp) = "0" Then 'UnSuccesful Return
Print #3, ReadLine
Else 'Success
Print "YES Found"
Print #2, ReadLine +"|"+StringCompareDCDB(DCDB,StringComp)
End If
End If
End If
Loop
'Output csv without successful returns
Close File #1
Close File #2
Close File #3
End Sub
Function StringCompareDCDB(ByVal DCDBTbl As String, ByVal LotPlan As String) As String
Dim i as Integer
Dim DCDBLot,SoundLot As String
Dim PreCoord As Float
i =0
Fetch First from DCDB
Do While Not EOT(DCDB)
i=i+1
'Print DCDB.Lot_plan
DCDBLot = UCase$(DCDB.Lot_plan)
SoundLot = UCase$(LotPlan)
If StringCompare(DCDBLot,SoundLot)= 0 Then
StringCompareDCDB = Format$(CentroidX(DCDB.Obj),"###.######")+"|"+Format$(CentroidY(DCDB.Obj),"###.######")
'StringCompareDCDB = Centroid(DCDB.Obj) 'Assighns Object - change function return type
Exit Sub
Else
StringCompareDCDB = "0"
End If
'If i = 30 Then
' Exit Sub
'End If
Fetch Next from DCDB
Loop
Print "The number of records searched and not found: "+i
End Function