2

Excelで、P1(lat1、long2)とP2(lat2 long2)の2点間の北からの進行方向を計算したいと思います。

4

2 に答える 2

0

アマチュア無線の計算に使用される関数があります。「純粋な」式は私には大きすぎました。

Function BearingFromCoord(lat_base_deg, long_base_deg, lat_dest_deg, long_dest_deg As Single) As Long
   Dim rad_deg_factor As Single
   Dim long_diff As Single
   Dim frac0 As Single
   Dim frac1 As Single
   Dim frac2 As Single
   Dim lat_base As Single
   Dim long_base As Single
   Dim lat_dest As Single
   Dim long_dest As Single
   Dim bearing As Single

   rad_deg_factor = 360 / (2 * pi())

   long_diff = (long_base_deg - long_dest_deg) / rad_deg_factor
     lat_base = lat_base_deg / rad_deg_factor
       lat_dest = lat_dest_deg / rad_deg_factor
          frac0 = Sin(lat_base) * Sin(lat_dest) _
              + Cos(lat_base) * Cos(lat_dest) _
                * Cos(long_diff)
             bearing = rad_deg_factor * Application.WorksheetFunction.Acos((Sin(lat_dest) _
                        - Sin(lat_base) * frac0) _
                    / (Cos(lat_base) * Sin(WorksheetFunction.Acos(frac0))))
          If Sin(long_diff) < 0 Then
            BearingFromCoord = bearing
          Else
            BearingFromCoord = 360 - bearing
          End If
End Function

Private Function pi() As Single
  pi = 3.1415926535
End Function
于 2012-11-08T07:22:42.133 に答える