简体   繁体   English

在excel中从纬度和经度计算航向

[英]calculating heading from latitude and longitude in excel

我想在 excel 中用 P1(lat1 , long2) 和 P2(lat2 long2) 计算 2 个点之间从北方的航向方向。

It depends on what level of accuracy you are looking for.这取决于您要寻找的准确度级别。 Haversine formula is simple yet may be insufficient since it assumes Earth surface is a perfect sphere (which it is not) and provides only limited accuracy. Haversine 公式很简单,但可能不够充分,因为它假设地球表面是一个完美的球体(事实并非如此)并且只能提供有限的精度。
Vincenty's formulae provide way better, geodesic grade accuracy (1.46E-6 degrees). Vincenty 的公式提供了更好的测地线坡度精度(1.46E-6 度)。
VBA Excel implementation I put together can be found on GitHub: https://github.com/tdjastrzebski/Vincenty-Excel .我整理的 VBA Excel 实现可以在 GitHub 上找到: https : //github.com/tdjastrzebski/Vincenty-Excel
VincentyInvFwdAzimuth() function should get you what you need. VincentyInvFwdAzimuth()函数应该VincentyInvFwdAzimuth()您的需求。

I have a function used for ham radio calculations.我有一个用于业余无线电计算的函数。 A "pure" formula was too bulky for me. “纯”配方对我来说太笨重了。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Excel 中使用纬度和经度计算大圆轨道 - Calculating Great Circle track using latitude and longitude in Excel 在Excel单元格中提取括号中的纬度和经度值 - extract latitude and longitude values in parenthesis in an excel cell 从 Excel 中的一个单元格文本字符串中提取一或两个单元格的经度和纬度 - Extract longitude and latitude to either one or two cells, from one cell text string in Excel 使用Excel纬度和经度表创建点Shapefile - Create Point Shapefile Using Excel Table of Latitude and Longitude 链接Google地球中折线段的MS Excel纬度/经度点 - link MS Excel Latitude/Longitude points for polyline segments in Google Earth 如何使用正确的纬度/经度格式将html表导出为ex​​cel? - How to export html table to excel with correct latitude/longitude format? 从Word提取标题到Excel - Extract Heading from Word to Excel 在Word中标题1之后从Microsoft Excel粘贴表 - Paste a Table from Microsoft Excel After Heading 1 in Microsoft Word 如何在Excel中从多个条件返回多个匹配项的列标题? - How to return the column heading for multiple matches, from multiple criteria, in Excel? 创建从Excel FlowChart到MS Word标题的超链接 - Creating hyperlink from Excel FlowChart to MS Word Heading
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM