Post by angelo2449 on Oct 25, 2023 8:33:13 GMT -5
Hi guys,
I wrote a decimal six angle converter in
sexagesimal angles.
I searched for online tests with different results.
The program is this:
These are the Input and Output data:
INPUT OUTPUT
8.98338307,45.55737837,219.925 - 59' 00.179052" 45d 33' 26.562132"
8.98338120,45.55739392,220.795 - 59' 00.172320" 45d 33' 26.618112"
8.98338043,45.55737818,219.938 - 59' 00.169548" 45d 33' 26.561448"
8.98338044,45.55737820,219.933 - 59' 00.169584" 45d 33' 26.561520"
8.98338044,45.55737820,219.929 - 59' 00.169584" 45d 33' 26.561520"
I think these results are right. What do you think?
Thank you very much
I wrote a decimal six angle converter in
sexagesimal angles.
I searched for online tests with different results.
The program is this:
nomainwin
i = 0
Percorso$ = "D:\AltProvvisori\Scaricati\"
PercorsoCorto$ = "D:\AltProvvisori\"
Filedialog "Open - Apri", Percorso$ + "*.csv", FileDaAprire$
if FileDaAprire$ = "" then wait
open PercorsoCorto$ + "Libretto_Corretto.dat" for output as #2
open FileDaAprire$ for input as #1
line input #1, Riga$
while eof(#1) = 0
line input #1, Riga$
'print Riga$
i = i + 1
Lon$ = mid$(Riga$, 6, 12)
if left$(Lon$, 1) = "," then Lon$ = mid$(Lon$, 2)
if left$(Lon$, 1) = "," then Lon$ = mid$(Lon$, 2)
'-----------------------------
GradiLon = int(val(Lon$))
GradiLon$ = str$(GradiLon)
if len(str$(int(val(GradiLon$)))) < 2 then GradiLon$ = " " + GradiLon$
'print "GradiLon$ = "; GradiLon$
'-----------------------------
FracLon = val(Lon$) - int(val(Lon$))
PrimiLon = int(FracLon * 60)
PrimiLon$ = str$(PrimiLon)
if len(str$(int(val(PrimiLon$)))) < 2 then PrimiLon$ = " " + PrimiLon$
'print "PrimiLon$ = "; PrimiLon$
'-----------------------------
Sec = FracLon * 60
FracSec = (Sec - int(Sec)) * 60
FracSec$ = str$(FracSec)
if len(str$(int(val(FracSec$)))) < 2 then FracSec$ = "0" + FracSec$
if len(FracSec$) < 9 then FracSec$ = FracSec$ + "0"
'print "FracSec$ = "; FracSec$
FracSec1$ = ""
for u = 1 to len(FracSec$)
if mid$(FracSec$, u, 1) <> "." then FracSec1$ = FracSec1$ + mid$(FracSec$, u, 1)
next u
Lon$ = GradiLon$ + "." + PrimiLon$ + FracSec1$
'print Lon$
'=============================
Pos1 = instr(trim$(Riga$), ",", 11)
Pos2 = instr(trim$(Riga$), ",", Pos1 + 1)
Lat$ = mid$(Riga$, Pos1 + 1, Pos2 - Pos1 - 1)
'print Lat$
GradiLat = int(val(Lat$))
GradiLat$ = str$(GradiLat)
if len(str$(int(val(GradiLat$)))) < 2 then GradiLat$ = " " + GradiLat$
'print "GradiLat$ = "; GradiLat$
'-----------------------------
FracLat = val(Lat$) - int(val(Lat$))
PrimiLat = int(FracLat * 60)
PrimiLat$ = str$(PrimiLat)
if len(str$(int(val(PrimiLat$)))) < 2 then PrimiLat$ = " " + PrimiLat$
'print "PrimiLat$ = "; PrimiLat$
'-----------------------------
Sec = FracLat * 60
FracSec = (Sec - int(Sec)) * 60
FracSec$ = str$(FracSec)
if len(str$(int(val(FracSec$)))) < 2 then FracSec$ = "0" + FracSec$
if len(FracSec$) < 9 then FracSec$ = FracSec$ + "0"
FracSec1$ = ""
for u = 1 to len(FracSec$)
if mid$(FracSec$, u, 1) <> "." then FracSec1$ = FracSec1$ + mid$(FracSec$, u, 1)
next u
'print "FracSec1$ = "; FracSec1$
Lat$ = GradiLat$ + "." + PrimiLat$ + FracSec1$
'print Lat$
'=============================
Pos3 = instr(trim$(Riga$), ",", Pos2 + 1)
Alt$ = mid$(Riga$, Pos2 + 1, Pos3 - Pos2 - 1)
'print Alt$
Nome$ = str$(i)
Linea$ = str$(i) + ", " + Nome$ + ", ?, " + Lat$ + "N, " + Lon$ + "E, " + Alt$
'print Linea$
print #2, Linea$
wend
close #1
close #2
Notice "Info" + chr$(13) + "Il Libretto Corretto รจ stato salvato come : " + chr$(13) +_
PercorsoCorto$ + "Libretto_Corretto.dat"
end
These are the Input and Output data:
INPUT OUTPUT
8.98338307,45.55737837,219.925 - 59' 00.179052" 45d 33' 26.562132"
8.98338120,45.55739392,220.795 - 59' 00.172320" 45d 33' 26.618112"
8.98338043,45.55737818,219.938 - 59' 00.169548" 45d 33' 26.561448"
8.98338044,45.55737820,219.933 - 59' 00.169584" 45d 33' 26.561520"
8.98338044,45.55737820,219.929 - 59' 00.169584" 45d 33' 26.561520"
I think these results are right. What do you think?
Thank you very much