----------------------------Original message---------------------------- NOTICE: LONG POSTING / INCLUDES BASIC PROGRAM WHICH IS NOT EXECUTABLE- YOU LOAD AS TEXT AND TAKE IT FROM THERE- Charles Gilley asks about computing the bearings between 2 coordinates. It makes my head hurt, too! Yes, it does involve trig, and to make the computations you must first compute the horizontal and vertical distances involved. Which would be easy, if the earth was flat, but it isn't. If you are interested in computations on a regional scale, certain assumptions can easliy be made. These assumptions are made by the FCC when computing the separation between 2 radio stations for frequency allocation. It may not be valid at distances exceeding 475 km. Here is a portion of that procedure: ************************************************************************** -CITE- 47 CFR Sec. 73.208 -EXPCITE- Title 47 CHAPTER I SUBCHAPTER C PART 73 Subpart B -HEAD- Sec. 73.208 Reference points and distance computations. -TEXT- <portions deleted> (c) The method given in this paragraph shall be used to compute the distance between two reference points, except that, for computation of distance involving stations in Canada and Mexico, the method for distance computation specified in the applicable international agreement shall be used instead. The method set forth in this paragraph is valid only for distances not exceeding 475 km (295 miles). (1) Convert the latitudes and longitudes of each reference point from degree-minute-second format to degree-decimal format by dividing minutes by 60 and seconds by 3600, then adding the results to degrees. (2) Calculate the middle latitude between the two reference points by averaging the two latitudes as follows: ML=(LAT1 (INFERIOR dd)+LAT2 (INFERIOR dd)) () 2 (3) Calculate the number of kilometers per degree latitude difference for the middle latitude calculated in paragraph (c)(2) as follows: KPD (INFERIOR lat)=111.13209-0.56605 cos(2ML)+0.00120 cos(4ML) (4) Calculate the number of kilometers per degree longitude difference for the middle latitude calculated in paragraph (c)(2) as follows: KPD (INFERIOR lon)=111.41513 cos(ML)-0.09455 cos(3ML)+0.00012 cos(5ML) (5) Calculate the North-South distance in kilometers as follows: NS=KPD (INFERIOR lat) (LAT1 (INFERIOR dd)-LAT2 (INFERIOR dd)) (6) Calculate the East-West distance in kilometers as follows: EW=KPD (INFERIOR lon) (LON1 (INFERIOR dd)-LON2 (INFERIOR dd)) (7) Calculate the distance between the two reference points by taking the square root of the sum of the squares of the East-West and North-South distances as follows: DIST=(NS (SUPERSCRIPT 2+)EW (SUPERSCRIPT 2)) (SUPERSCRIPT 0.5) (8) Round the distance to the nearest kilometer. (9) Terms used in this section are defined as follows: (i) LAT1 (INFERIOR dd) and LON1 (INFERIOR dd)=the coordinates of the first reference point in degree-decimal format. (ii) LAT2 (INFERIOR dd) and LON2 (INFERIOR dd)=the coordinates of the second reference point in degree-decimal format. (iii) ML=the middle latitude in degree-decimal format. (iv) KPD (INFERIOR lat)=the number of kilometers per degree of latitude at a given middle latitude. (v) KPD (INFERIOR lon)=the number of kilometers per degree of longitude at a given middle latitude. (vi) NS=the North-South distance in kilometers. (vii) EW=the East-West distance in kilometers. (viii) DIST=the distance between the two reference points, in kilometers. (28 FR 13623, Dec. 14, 1963, as amended at 29 FR 14116, Oct. 14, 1964; 48 FR 29505, June 27, 1983; 52 FR 37788, Oct. 9, 1987; 52 FR 39920, Oct. 26, 1987; 54 FR 9806, Mar. 8, 1989) ***************************************************************************** Now that you have computed the NS distance (vertical) and the EW distance (horizontal) you can compute the angle. I use a simple basic program which you can run in QBASIC (open d&b.txt) which computes the distance and bearings using the FCC's procedure. To use it, extract this file and with an editor (dos EDIT or equiv.) take out all but the numbered lines below. It works, and it will keep your head from hurting! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Bill Fawcett [log in to unmask] James Madison University adm_wfawcett@jmuvax (bitnet) 821 S. Main Street, Harrisonburg, VA 22807 (703) 568-3809 voice N. Lat. 38-26-27 W. Long. 78-52-33 (703) 568-3814 fax - - Virginia- The home of Matthew Fontaine Maury - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BASIC PROGRAM d&b.txt to follow: 1 CLS 5 PRINT" ":PRINT" " 10 DIM L(2,2,3) 15 TB=(8) 20 PRINT:PRINT:PRINT 30 A$="DISTANCE AND BEARING BASED ON FCC REPORT R-6501" 40 PRINT"DISTANCE AND BEARING BASED ON FCC REPORT R-6501":PRINT:PRINT 50 LINE INPUT"POINT A NAME :? ";P$ 60 INPUT "POINT A CO-ORDS (D,M,S,D,M,S) :";L(1,1,1),L(1,1,2),L(1,1,3),L(1,2,1),L(1,2,2),L(1,2,3) 70 PRINT:PRINT:PRINT 80 LINE INPUT"POINT B NAME :? ";Q$ 90 INPUT "POINT B CO-ORDS (D,M,S,D,M,S) :";L(2,1,1),L(2,1,2),L(2,1,3),L(2,2,1),L(2,2,2),L(2,2,3) 100 Z=60 110 F5LA(1)=L(1,1,1)+L(1,1,2)/Z+L(1,1,3)/Z^2 120 F6LO(1)=L(1,2,1)+L(1,2,2)/Z+L(1,2,3)/Z^2 130 F5LA(2)=L(2,1,1)+L(2,1,2)/Z+L(2,1,3)/Z^2 140 F6LO(2)=L(2,2,1)+L(2,2,2)/Z+L(2,2,3)/Z^2 150 A=69.054141#:B=.351726:C=.000746:D=69.23001:E=.0587505:G=7.500001E-05 160 E1L=(F5LA(1)+F5LA(2))/2:EL=E1L/57.29578:EM=A-B*COS(2*EL)+C*COS(4*EL) 170 PP=D*COS(EL)-E*COS(3*EL)+G*COS(5*EL):DLA=F5LA(1)-F5LA(2):D6LO=F6LO(2)-F6LO(1) 180 DA=EM*DLA:DD=PP*D6LO:PI=3.141593:RAD=57.2958:D7BS=SQR(DA^2+DD^2) 190 ON SGN(DA)+2 GOTO 200,250,200 200 G=ATN(DD/DA):HH=G 210 ON SGN(DA)+2 GOTO 220,250,230 220 HH=G+PI:GOTO 280 230 ON SGN(DD)+2 GOTO 240,280,280 240 HH=G+2*PI:GOTO 280 250 ON SGN(DD)+2 GOTO 260,270,270 260 HH=2*PI:GOTO 280 270 HH=O 280 Q=HH*RAD 290 ON SGN(Q-180)+2 GOTO 300,310,310 300 RRR=Q+180:GOTO 320 310 RRR=Q-180 320 ' 330 BB(1)=RRR 340 ON SGN(BB(1)-180)+2 GOTO 350,360,360 350 BB(2)=BB(1)+180:GOTO 370 360 BB(2)=BB(1)-180 370 ' 380 ' 390 PRINT" ":PRINT" ":PRINT" " 400 PRINT"DISTANCE BETWEEN POINTS : ";D7BS; " MILES " 410 PRINT" " 420 PRINT" " 430 PRINT"BEARING TO POINT B FROM A IS: ";BB(1);" DEGREES" 440 PRINT" " 450 PRINT"BEARING FROM POINT B TO A IS: ";BB(2);" DEGREES" 460 Z$="FROM (POINT A) \ \ ## ## ##.# ### ## ##.# " 461 G$="TO (POINT B) \ \ ## ## ##.# ### ## ##.# " 470 X$="BEARING TO B: ###.## BEARING FROM B: ###.## " 471 H$="DISTANCE: ####.## MILES (####.## KM)" 480 PRINT:PRINT 490 INPUT"PRINTER READY (HIT ENTER TO CONTINUE) :";PT 510 LPRINT TAB(TB);:LPRINT A$:LPRINT " " 511 LPRINT TAB(TB);:LPRINT USING Z$;P$,L(1,1,1),L(1,1,2),L(1,1,3),L(1,2,1),L(1,2,2),L(1,2,3) 512 LPRINT TAB(TB);:LPRINT USING G$;Q$,L(2,1,1),L(2,1,2),L(2,1,3),L(2,2,1),L(2,2,2),L(2,2,3) 520 LPRINT" ":LPRINT TAB(TB);:LPRINT USING X$;BB(1),BB(2) 521 LPRINT" ":LPRINT TAB(TB);:LPRINT USING H$;D7BS,D7BS*1.609344 530 LPRINT" " 540 LPRINT" " 541 INPUT"REPEAT RUN? <Y> OR <N>";RR$:PRINT 542 IF RR$="Y" OR RR$="y" THEN GOTO 70 550 END