The Great Circle Route

See all articles from SYNC v1 n5
Author(s): Chuck Dawson
Publication: SYNC
Pub Details: SYNC v1 n5 (Volume 1, Issue 5)
Date: September/October 1981
Pages: 38
World map showing a great circle route
World map showing a great circle route

For those who have the 8K ROM. “The Great Circle Route” shows something of its possibilities. After entering the program on your computer, enter the latitude and longitude of any two points in the world, and the computer will calculate and display the distance between them. This is the “great circle route.” The primary answer is in nautical miles, but this answer is converted to statute miles by line 200. Line 200 can be used to convert the answer to kilometers by changing the .115 multiplication factor to .185035. The program requires 2K RAM but it may be usable on 1K machines by using one letter names for the variables leaving out the seconds input portion, and omitting the conversion provision in line 200.

When you enter a longitude east of Greenwich or a latitude south of the equator, use negative numbers.

After years of looking up trig functions in tables, I am amazed by the speed at which this program runs.

 10 REM "GREAT CIRCLE"
20 PRINT "DEPARTURE POINT"
30 GOSUB 400
40 LET LAT1=LAT*PI/180
50 GOSUB 450
60 LET LONG1=LONG
100 PRINT "DESTINATION"
110 GOSUB 400
120 LET LAT2=LAT*PI/180
130 GOSUB 450
140 LET LONG2=LONG
150 CLS
160 LET D=(LONG1-LONG2)*PI/180
170 LET Z=SIN LAT1*SIN LAT2+(COS LAT1*COS LAT2*COS D)
180 LET DIST=INT (.5+(108000/PI*ACS Z))
190 PRINT AT 10,0;"DISTANCE#=#";DIST/10;"#NAUTICAL MILES"
200 PRINT "OR#";.115*DIST;"#STATUTE MILES"
210 STOP
300 SAVE "GREAT CIRCLE"
320 RUN
400 PRINT "LATITUDE"
410 GOSUB 500
420 LET LAT=DEG+MIN/60+SEC/3600
430 RETURN
450 PRINT "LONGITUDE"
460 GOSUB 500
470 LET LONG=DEG+MIN/60+SEC/3600
480 RETURN
500 PRINT "INPUT DEGREES#";
510 INPUT DEG
520 PRINT DEG
530 PRINT "INPUT MINUTES#";
540 INPUT MIN
550 PRINT MIN
560 PRINT "INPUT SECONDS#";
570 INPUT SEC
580 PRINT SEC
590 PRINT
600 RETURN

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.