• <bdo id='NS53A'></bdo><ul id='NS53A'></ul>
      <tfoot id='NS53A'></tfoot>

      1. <legend id='NS53A'><style id='NS53A'><dir id='NS53A'><q id='NS53A'></q></dir></style></legend>
      2. <i id='NS53A'><tr id='NS53A'><dt id='NS53A'><q id='NS53A'><span id='NS53A'><b id='NS53A'><form id='NS53A'><ins id='NS53A'></ins><ul id='NS53A'></ul><sub id='NS53A'></sub></form><legend id='NS53A'></legend><bdo id='NS53A'><pre id='NS53A'><center id='NS53A'></center></pre></bdo></b><th id='NS53A'></th></span></q></dt></tr></i><div id='NS53A'><tfoot id='NS53A'></tfoot><dl id='NS53A'><fieldset id='NS53A'></fieldset></dl></div>

        <small id='NS53A'></small><noframes id='NS53A'>

        C#中2个纬度/经度点之间的方向

        Direction between 2 Latitude/Longitude points in C#(C#中2个纬度/经度点之间的方向)

          • <bdo id='2iLBi'></bdo><ul id='2iLBi'></ul>
            <i id='2iLBi'><tr id='2iLBi'><dt id='2iLBi'><q id='2iLBi'><span id='2iLBi'><b id='2iLBi'><form id='2iLBi'><ins id='2iLBi'></ins><ul id='2iLBi'></ul><sub id='2iLBi'></sub></form><legend id='2iLBi'></legend><bdo id='2iLBi'><pre id='2iLBi'><center id='2iLBi'></center></pre></bdo></b><th id='2iLBi'></th></span></q></dt></tr></i><div id='2iLBi'><tfoot id='2iLBi'></tfoot><dl id='2iLBi'><fieldset id='2iLBi'></fieldset></dl></div>
          • <tfoot id='2iLBi'></tfoot>
              <legend id='2iLBi'><style id='2iLBi'><dir id='2iLBi'><q id='2iLBi'></q></dir></style></legend>
                <tbody id='2iLBi'></tbody>
              • <small id='2iLBi'></small><noframes id='2iLBi'>

                • 本文介绍了C#中2个纬度/经度点之间的方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有 2 个经纬度格式的坐标.

                  I have 2 coordinates in Lat Long format.

                  我如何确定从 A 点(例如 New York 37.149472,-95.509544 )到 B 点的方向(例如 Toronto 40.714269,-74.005973)

                  How do I determine from Point A (eg New York 37.149472,-95.509544 ) the direction in degrees to point B (eg Toronto 40.714269,-74.005973)

                  我正在寻找像340 度"这样的值

                  I'm looking for a value like "340 Degrees"

                  在 C# 中

                  推荐答案

                  如果你想要一个恒定的方位跟随你不想要最短(大圆)路径,你想要一个 Rhumb 线

                  If you want a constant bearing to follow you don't want the shortest (great circle) path you want a Rhumb line

                  Movable Type 脚本的转换

                  Conversion of the Movable Type Scripts for that

                  static double DegreeBearing(
                      double lat1, double lon1, 
                      double lat2, double lon2)
                  {   
                      var dLon = ToRad(lon2-lon1);
                      var dPhi = Math.Log(
                          Math.Tan(ToRad(lat2)/2+Math.PI/4)/Math.Tan(ToRad(lat1)/2+Math.PI/4));
                      if (Math.Abs(dLon) > Math.PI) 
                          dLon = dLon > 0 ? -(2*Math.PI-dLon) : (2*Math.PI+dLon);
                      return ToBearing(Math.Atan2(dLon, dPhi));
                  }
                  
                  public static double ToRad(double degrees)
                  {
                      return degrees * (Math.PI / 180);
                  }
                  
                  public static double ToDegrees(double radians)
                  {
                      return radians * 180 / Math.PI;
                  }
                  
                  public static double ToBearing(double radians) 
                  {  
                      // convert radians to degrees (as bearing: 0...360)
                      return (ToDegrees(radians) +360) % 360;
                  }
                  
                  // verify against the website example
                  DegreeBearing(50.36389,-4.15694,42.35111,-71.04083);
                  

                  这篇关于C#中2个纬度/经度点之间的方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                  Accessing attribute info from DTE(从 DTE 访问属性信息)
                  c# Hide a property in datagridview with datasource(c#使用数据源隐藏datagridview中的属性)
                  Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                  C# Attributes and their uses(C# 属性及其用途)
                  C# - Getting all enums value by attribute(C# - 按属性获取所有枚举值)
                  <i id='pP1WJ'><tr id='pP1WJ'><dt id='pP1WJ'><q id='pP1WJ'><span id='pP1WJ'><b id='pP1WJ'><form id='pP1WJ'><ins id='pP1WJ'></ins><ul id='pP1WJ'></ul><sub id='pP1WJ'></sub></form><legend id='pP1WJ'></legend><bdo id='pP1WJ'><pre id='pP1WJ'><center id='pP1WJ'></center></pre></bdo></b><th id='pP1WJ'></th></span></q></dt></tr></i><div id='pP1WJ'><tfoot id='pP1WJ'></tfoot><dl id='pP1WJ'><fieldset id='pP1WJ'></fieldset></dl></div>

                      <small id='pP1WJ'></small><noframes id='pP1WJ'>

                          <tbody id='pP1WJ'></tbody>

                        1. <legend id='pP1WJ'><style id='pP1WJ'><dir id='pP1WJ'><q id='pP1WJ'></q></dir></style></legend>
                          • <bdo id='pP1WJ'></bdo><ul id='pP1WJ'></ul>
                          • <tfoot id='pP1WJ'></tfoot>