• <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个纬度/经度点之间的方向

        时间:2023-07-25

          • <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个纬度/经度点之间的方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:旋转后查找线/点左侧的点 下一篇:如何判断某个点是否在某条线附近?

                  相关文章

                  <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'>

                    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>
                    2. <tfoot id='pP1WJ'></tfoot>