[aprssig] A math problem concerning Lat and Long

Robert Bruninga bruninga at usna.edu
Tue Oct 5 21:00:05 EDT 2004


>>> kb2scs at optonline.net 10/5/04 8:42:00 PM >>>
>>
>Given a known Latitude and Longitude ..
>After moving this distance and direction what is your 
>new Latitude and Longitude?

Here is the APRSdos code for determining the distance
between any two lat/longs.  To break it down to the
North and West componet, just take the Sin and Cos
components of the resulting vector

SUB RangeRings (d,rng)
    
STATIC Lcux, Lcuy, LaO, LoO

'convert to radians     
   r = 180 / 3.14159
   LA1 = LAT1 / r: LA2 = LAT2/ r
   LO1 = LON1/ r: LO2 = LON2/ r

   xj# = SIN(LA1) * SIN(LA2) + COS(LA1) * COS(LA2) * COS(LO2 - LO1)
   REM xj= cos(D/(60*r))
   REM sin(D/(60*r))=sqr(1-xj^2)

   xk# = SQR(1 - xj# ^ 2)
   IF ABS(CDX - CPX) = 0 THEN
      d = 60 * ABS(CDY - CPY)
   ELSEIF xk# <> 0 THEN
      d = 60 * r * (90 / r - ATN(xj# / xk#))
      xi# = (SIN(LA2) - SIN(LA1) * xj#) / (xk# * COS(LA1))
      xh# = r * (90 / r - ATN(xi# / (SQR(1 - xi# ^ 2))))
      a = SIN((LO2 - LO1) / r)
      IF a > 0 THEN AZ = 360 - xh# ELSE AZ = xh#
   ELSE AZ = 0: d = 0
   END IF

'at this point d is in nautical miles in a direction AZ.
'to convert to range in statute miles multiply by 1.1508
'and I convert to feet if less than .2 miles
    rng = d * 1.1508
    IF rng < .2 THEN rng = rng * 5280: x$ = "ft"
 
end sub
 de WB4APR, Bob




More information about the aprssig mailing list