| HOME |
BACK |
UTM4.prg
/****************************************************************************
/ Program for Traverse Computation & Adjustment
/ Originally written in BASIC by Mr. Narong Sopak,
/ Director Topographic Survey Division
/ Royal Irrigation Dept, Thailand
/ It has been used by surveyors in the division since 1983
/ Translated to Noobeed language by : chainman
/
date : 11/26/01
/ Note: - all variable name are kept as original
/ - style and algorithm are kept close
to the
/ original version as much
as possible
/*************************************************************************
/ IMPORTANT change the following value according to the working ellipsoid
/ The initial values here are those of "Everest" ellipsoid
/ Unless UTM scale factor is not going to be used
a_ellipsoid = 6377276.34518
f_ellipsoid = 1/300.8017
/*************************************************************************
MAX_ANG = 100
MAX_SEC = 10
print "******************************************"
print
print "Traverse Computation and Adjustment on UTM"
print
print "******************************************"
print
print
fname = String()
input "Data file name : " fname
Vstr_inp = VecStr()
Vstr_inp.load(fname)
IANG = Vstr_inp.size()
/ ST is to store station name
/ A is to store angle
/ OD is to store distance
/ AZ is to store azimuth
/ IAZ is to store station number at which control azi is known
ST = VecStr(MAX_ANG)
OA = Vector(MAX_ANG)
OD = Vector(MAX_ANG)
AZ = Vector(MAX_ANG)
DSU = Vector(MAX_ANG)
NO = Vector(MAX_ANG)
EA = Vector(MAX_ANG)
IAZ = Vecint(MAX_ANG)
ER = Vector(MAX_SEC)
COR = Vector(MAX_SEC)
ER.mpushback (0,MAX_SEC)
COR.mpushback(0,MAX_SEC)
AZ.mpushback (0,MAX_ANG)
NO.mpushback (0,MAX_ANG)
EA.mpushback (0,MAX_ANG)
DSU.mpushback(0,MAX_ANG)
OA.mpushback(0,MAX_ANG)
OD.mpushback(0,MAX_ANG)
ST.mpushback(" ",MAX_ANG)
ST(0) = Vstr_inp(0)
SMD = 0
for i=1, IANG-1
V_Str_tmp = Vstr_inp(i).extract(3)
ST(i) = V_Str_tmp(0)
OA(i) = deg(V_Str_tmp(1).val())
OD(i) = V_Str_tmp(2).val()
SMD = SMD + OD(i)
end
/**********************************************************************
/ Azimuth computation & adjustment
/**********************************************************************
/ ISTATUS = status of angle ( + or -)
/ INAZ = no of controled azimuth
/ J = angle counter for each section
ISTATUS = 0
INAZ = 0
J = 0
L = 2
Azi = double()
input "1st Azimuth (DD.MMSSSSSS) : " Azi
AZ(1) = deg(Azi)
for I=2, IANG-1
if(OA(I-1)<0)
ISTATUS = 1
INAZ = INAZ + 1
IAZ.pushback(I)
end
J = J + 1
TZ = AZ(I-1) + abs(OA(I-1)) - 180
if TZ < 0
TZ = TZ + 360
end
if TZ > 360
TZ = TZ - 360
end
AZ(I) = TZ
set align "R"
set width 15
print " " dms(AZ(I),2)
if ISTATUS == 1
input "Closing azimuth (DD.MMSSSSSS) : " Azi
ER(INAZ) = AZ(I) - deg(Azi)
COR(INAZ) = -ER(INAZ) / J
for K=1,J
AZ(L) = AZ(L) + K*COR(INAZ)
L = L+1
end
ISTATUS = 0
J = 0
end
end
/*************************************************************************
/ Coordinate computation & adjustment
/*************************************************************************
print
QT = String()
QF = String()
SN = double()
SE = double()
CN = double()
CE = double()
input "Closed traverse ( Y or N) : " QT
input "Apply scale factor (Y or N): " QF
input "Starting coordinate N : " SN
input "Starting coordinate E : " SE
if QT=="Y" | QT=="y"
input "Closing coordinate N : " CN
input "Closing coordinate E : " CE
end
if QF=="Y" | QF=="y"
input "Mean latitude : " ALAT
input "Mean elevation : " H
ALAT = deg(ALAT)
else
ALAT = 0
H = 0
end
/ SGD = sum of grid distance
/ HF = height factor
SGD = 0
E = SE
N = SN
if QF=="Y" | QF=="y"
SI = sin(ALAT)
T = 2*f_ellipsoid - f_ellipsoid^2
RM = sqrt(1-T)*a_ellipsoid/(1-T*SI*SI)
RR2 = 2*RM*RM
HF = 1-H/RM
end
/ J is counter for computed N & E
if(OD(1) <> 0)
J = 1
else
J = 2
DSU(J-1) = 0
end
while OD(J) <> 0
print ST(J)
SI = sin(AZ(J))
CO = cos(AZ(J))
if(QF=="Y" | QF=="y")
EP = E - 500000
EI = 0.9996 * (1+EP*EP/RR2) * HF*OD(J)*SI + E
EIP = EI - 500000
GD = ((EP*EP + EP*EIP + EIP*EIP) / RR2 / 3+1) *
0.9996 * HF * OD(J)
SGD = SGD + GD
else
GD = OD(J)
SGD = SGD + GD
end
NO(J) = GD*CO + N
EA(J) = GD*SI + E
DSU(J) = DSU(J-1) + GD
N = NO(J)
E = EA(J)
J = J + 1
end
if QT=="Y" | QT=="y"
print
print
ERRN = N - CN
CON = -ERRN / SGD
ERRE = E - CE
COE = -ERRE / SGD
CL = sqrt(ERRN^2 + ERRE^2)
CLO = 1 / sqrt(CON^2 + COE^2)
set width 10
print "Sum of measured distance " SMD
print "Sum of grid distance " SGD
print "Error in Easting " ERRE
print "Error in Northing " ERRN
print "Linear closure " CL
print "Linear closure ratio 1 / " int(CLO)
print
print
B = String()
input "Continue (Y or N) ? " B
if B=="N" | B=="n"
exit
end
end
print
print
fname_out = String()
PR = String()
LP = String()
YR = String()
ds = String()
input "Output file name : " fname_out
input " Project name : " PR
input " Loop : " LP
input " Year : " YR
print
input "report accumulated distance instead of observed distance <N> : " ds
/******************************************************************
/ Writing Output file
/******************************************************************
fout_old = getfout()
set fout fname_out
fprint " ********************"
fprint " TRAVERSE COMPUTATION"
fprint " ********************"
fprint
set align "L"
fprint " Project : " PR;
fprint " Loop : " LP;
fprint " Year : " YR
fprint
fprint
for I=1, INAZ
set width 3
fprint "Error in section" I;
fprint " = ";
set width 10
fprint ER(I)*3600;
fprint " sec correct per angle " COR(I)*3600
end
fprint
set width 10
set align "R"
fprint "Mean latitude " dms(ALAT,0)
fprint "Mean elevation " H
fprint "Sum of measured distance " SMD
fprint "Sum of grid distance " SGD
fprint "Error in Norting " ERRN
fprint "Error in Easting " ERRE
fprint "Linear closure " CL
fprint "Closing ratio 1/ " int(CLO)
fprint
fprint
"-----------------------------------------------------------------------------------"
fprint "Station Observed Adjusted Distance Northing Easting "
if (ds=="Y" | ds=="y")
fprint " angle Azimuth Sum Up"
else
fprint " angle Azimuth"
end
fprint
"-----------------------------------------------------------------------------------"
set width 15
set precision 3
if (OD(1)==0)
set align "L"
set width 11
fprint ST(0)
fprint ST(1);
set width 15
set align "R"
fprint dms(OA(1),1);
fprint dms(AZ(1),1);
set width 10
fprint " ";
set width 15
fprint SN;
fprint SE
else
set align "L"
set width 11
fprint ST(0);
set width 40
fprint " ";
set width 15
fprint SN;
fprint SE
end
if (OD(1) > 0)
J = 1
else
J = 2
end
print
print "Writing output"
while OD(J)<>0
set align "R"
print ST(J)
N = NO(J) + DSU(J) * CON
E = EA(J) + DSU(J) * COE
found = 0
for I = 0,INAZ-1
if J==IAZ(I)
found = 1
end
end
if found==1
if(ds=="Y" | ds=="y")
set align "L"
set width 11
fprint ST(J);
set align "R"
tmp = abs(OA(J))
set width 15
fprint dms(tmp,1);
set width 2
fprint " **";
set width 12
fprint dms(AZ(J),1);
set width 10
fprint DSU(J);
else
set align "L"
set width 11
fprint ST(J);
set align "R"
set width 15
tmp = abs(OA(J))
fprint dms(tmp,1);
set width 2
fprint " **";
set width 12
fprint dms(AZ(J),1);
set width 10
fprint OD(J);
end
else
if(ds=="Y" | ds=="y")
set align "L"
set width 11
fprint ST(J);
set align "R"
set width 15
tmp = abs(OA(J))
fprint dms(tmp,1);
fprint dms(AZ(J),1);
set width 10
fprint DSU(J);
else
set align "L"
set width 11
fprint ST(J);
set align "R"
set width 15
tmp = abs(OA(J))
fprint dms(tmp,1);
fprint dms(AZ(J),1);
set width 10
fprint OD(J);
end
end
set width 15
fprint N;
fprint E
J = J + 1
end
/ print the last station with its azimuth
set align "L"
set width 11
fprint ST(J);
set align "R"
set width 15
fprint " " dms(AZ(J),1)
fprint
"-----------------------------------------------------------------------------------"
/ restore fout
set fout fout_old
|
An example of input data file
Note :- put a negative sign in front of an
angle before a control azimuth
- Each line MUST have 3 fields, except the very first line. They are
station-name, observed angle in DD.MMSSS format, and observed distance
- data in each line are separated by at least ONE space
- distance is from the station of THAT line to the station of the PREVIOUS line
BM-001
BM-002 181.522767 0
A-2 95.063482 54.95
A-3 244.345872 35.353
A-4 120.043152 12.001
A-5 198.300555 30.67
A-6 125.492567 14.8
A-7 218.165117 21.851
A-8 75.453087 38.73
A-9 190.555917 23.182
A-10 217.590492 23.344
A-11 206.41241 40.182
A-12 142.054947 53.561
A-13 133.572802 29.853
A-14 239.435047 46.178
A-15 196.130777 28.069
A-16 200.451272 33.094
A-17 214.104187 13.056
A-18 180.41577 17.945
A-19 173.070342 26.958
A-20 171.541532 20.926
BM-003 -119.483052 17.919
BM-004 151.03084 239.508
A-23 172.252835 30.02
A-24 174.17159 79.931
A-25 185.000447 50.029
A-26 158.494375 70.371
A-27 165.47252 45.846
A-28 171.26504 30.252
A-29 174.181717 58.71
A-30 189.015492 77.626
BM-005 164.213055 43.921
BM-006 100.52593 81.409
A-33 118.295615 23.643
A-34 221.284522 54.92
A-35 128.0308 27.439
A-36 191.033775 70.076
A-37 264.290782 32.945
A-38 144.324612 26.105
A-39 253.033755 20.001
A-40 233.363462 34.041
A-41 153.030735 24.046
A-42 87.444155 19.609
A-43 133.130305 33.001
A-44 212.45192 25.112
A-45 253.372537 34.93
A-46 237.330712 29.977
A-47 79.5639 28.475
A-48 197.5029 45.487
A-49 156.274517 19.897
A-50 123.481115 28.204
A-51 219.204462 11.113
A-52 160.41112 44.94
A-53 213.591415 25.582
A-54 252.382512 15.869
A-55 73.37173 14.945
A-56 96.045765 14.963
A-57 273.210767 13.104
A-58 261.475127 14.821
A-59 73.56561 34.023
A-60 152.434117 88.917
A-61 281.430352 19.603
A-62 110.081165 11.729
A-63 128.521312 14.838
A-64 166.003387 26.141
A-65 204.17097 39.159
A-66 259.162392 105.639
A-67 154.100927 35.612
A-68 172.133975 34.111
A-69 207.081552 34.016
A-70 219.142115 29.024
BM-001 -92.2818 30.038
BM-002 0.0000 56.111 |
An example of output file
********************
TRAVERSE COMPUTATION
********************
Project : Cha-am
Loop : 1-A
Year : 1994
Error in section 1 = 11.460 sec
correct per angle -0.546
Error in section 2 = 25.320 sec
correct per angle -0.506
Mean latitude
0 00 00.0
Mean elevation
0.000
Sum of measured distance 2682.451
Sum of grid distance 2682.451
Error in Norting
0.108
Error in Easting
-0.109
Linear closure
0.153
Closing ratio 1/
17488
-----------------------------------------------------------------------------------
Station Observed
Adjusted Distance Northing
Easting
angle Azimuth
-----------------------------------------------------------------------------------
BM-001
BM-002 181 52 27.7
92 12 00.0
10000.000 10000.000
A-2
95 06 34.8 94 04 27.1 54.950
9996.094 10054.813
A-3 244 34
58.7 9 11 01.4 35.353
10030.992 10060.457
A-4 120 04
31.5 73 45 59.6 12.001
10034.347 10071.980
A-5 198 30
05.6 13 50 30.5 30.670
10064.125 10079.319
A-6 125 49
25.7 32 20 35.6 14.800
10076.628 10087.237
A-7 218 16
51.2 338 10 00.7 21.851
10096.911 10079.112
A-8
75 45 30.9 16 26 51.3 38.730
10134.054 10090.079
A-9 190 55
59.2 272 12 21.6 23.182
10134.946 10066.915
A-10 217 59 04.9
283 08 20.2 23.344 10140.251
10044.184
A-11 206 41 24.1
321 07 24.6 40.182 10171.531
10018.965
A-12 142 05 49.5
347 48 48.2 53.561 10223.883
10007.661
A-13 133 57 28.0
309 54 37.1 29.853 10243.035
9984.763
A-14 239 43 50.5
263 52 04.6 46.178 10238.101
9938.851
A-15 196 13 07.8
323 35 54.5 28.069 10260.692
9922.195
A-16 200 45 12.7
339 49 01.7 33.094 10291.752
9910.779
A-17 214 10 41.9
0 34 13.9 13.056 10304.807
9910.909
A-18 180 41 57.7
34 44 55.2 17.945 10319.551
9921.138
A-19 173 07 03.4
35 26 52.4 26.958 10341.511
9936.774
A-20 171 54 15.3
28 33 55.3 20.926 10359.889
9946.781
BM-003 119 48 30.5
20 28 10.0 17.919 10376.676
9953.048
BM-004 151 03 08.4 ** 320 16
40.0 239.508 10560.884
9799.996
A-23 172 25 28.4
291 19 47.9 30.020 10571.802
9772.034
A-24 174 17 15.9
283 45 15.7 79.931 10590.804
9694.398
A-25 185 00 04.5
278 02 31.1 50.029 10597.801
9644.863
A-26 158 49 43.7
283 02 35.1 70.371 10613.679
9576.311
A-27 165 47 25.2
261 52 18.3 45.846 10607.195
9530.927
A-28 171 26 50.4
247 39 43.0 30.252 10595.696
9502.946
A-29 174 18 17.2
239 06 32.9 58.710 10565.552
9452.567
A-30 189 01 54.9
233 24 49.6 77.626 10519.281
9390.239
BM-005 164 21 30.5
242 26 44.0 43.921 10498.962
9351.302
BM-006 100 52 59.3
226 48 14.0 81.409 10443.235
9291.957
A-33 118 29 56.1
147 41 12.8 23.643 10423.252
9304.596
A-34 221 28 45.2
86 11 08.5 54.920 10426.903
9359.397
A-35 128 03 08.0
127 39 53.2 27.439 10410.136
9381.119
A-36 191 03 37.7
75 43 00.7 70.076 10427.422
9449.031
A-37 264 29 07.8
86 46 37.9 32.945 10429.273
9481.926
A-38 144 32 46.1
171 15 45.2 26.105 10403.469
9485.892
A-39 253 03 37.6
135 48 30.9 20.001 10389.128
9499.835
A-40 233 36 34.6
208 52 07.9 34.041 10359.316
9483.401
A-41 153 03 07.4
262 28 42.0 24.046 10356.167
9459.563
A-42 87 44
41.5 235 31 48.9 19.609
10345.068 9443.398
A-43 133 13 03.0
143 16 29.9 33.001 10318.616
9463.133
A-44 212 45 19.2
96 29 32.4 25.112 10315.776
9488.085
A-45 253 37 25.4
129 14 51.1 34.930 10293.675
9515.137
A-46 237 33 07.1
202 52 16.0 29.977 10266.053
9503.487
A-47 79 56
39.0 260 25 22.6 28.475
10261.315 9475.410
A-48 197 50 29.0
160 22 01.1 45.487 10218.470
9490.695
A-49 156 27 45.2
178 12 29.6 19.897 10198.582
9491.318
A-50 123 48 11.1
154 40 14.3 28.204 10173.089
9503.386
A-51 219 20 44.6
98 28 24.9 11.113 10171.451
9514.378
A-52 160 41 11.2
137 49 09.0 44.940 10138.147
9544.556
A-53 213 59 14.2
118 30 19.7 25.582 10125.937
9567.037
A-54 252 38 25.1
152 29 33.4 15.869 10111.862
9574.367
A-55 73 37
17.3 225 07 58.0 14.945
10101.318 9563.776
A-56 96 04
57.6 118 45 14.8 14.963
10094.119 9576.894
A-57 273 21 07.7
34 50 11.9 13.104 10104.874
9584.380
A-58 261 47 51.3
128 11 19.1 14.821 10095.710
9596.030
A-59 73 56
56.1 209 59 09.8 34.023
10066.240 9579.027
A-60 152 43 41.2
103 56 05.4 88.917 10044.824
9665.331
A-61 281 43 03.5
76 39 46.1 19.603 10049.345
9684.406
A-62 110 08 11.7
178 22 49.1 11.729 10037.620
9684.738
A-63 128 52 13.1
108 31 00.3 14.838 10032.907
9698.808
A-64 166 00 33.9
57 23 12.9 26.141 10046.995
9720.829
A-65 204 17 09.7
43 23 46.2 39.159 10075.448
9747.734
A-66 259 16 23.9
67 40 55.4 105.639 10115.559
9845.464
A-67 154 10 09.3
146 57 18.8 35.612 10085.706
9864.885
A-68 172 13 39.7
121 07 27.6 34.111 10068.073
9894.087
A-69 207 08 15.5
113 21 06.8 34.016 10054.588
9925.318
A-70 219 14 21.1
140 29 21.9 29.024 10032.195
9943.784
BM-001 92 28 18.0
179 43 42.5 30.038 10002.156
9943.928
BM-002 0 00 00.0
** 92 12 00.0 56.111
10000.000 10000.000
0 00 00.0
----------------------------------------------------------------------------------- |
| HOME |
BACK |
|