纬度/经度 + 距离 + 航向 -->纬度/经度 [英] Lat/Lon + Distance + Heading --> Lat/Lon

查看:31
本文介绍了纬度/经度 + 距离 + 航向 -->纬度/经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以:我有以下函数,改编自网上找到的公式,它采用两个纬度/经度坐标并找到它们之间的距离(沿球形地球):

So: I have the following function, adapted from a formula found online, which takes two lat/lon coordinates and finds the distance between them in miles (along a spherical Earth):

public static double distance (double lat1, double lon1, double lat2, double lon2) {
        double theta = toRadians(lon1-lon2);
        lat1 = toRadians(lat1);
        lon1 = toRadians(lon1);
        lat2 = toRadians(lat2);
        lon2 = toRadians(lon2);

        double dist = sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2)*cos(theta);
        dist = toDegrees(acos(dist)) * 60 * 1.1515 * 1.609344 * 1000;

        return dist;
    }

据我所知,这很好用.

我需要的是第二个函数,它使用完全相同的地球几何模型,采用单个纬度/经度对 [A]、航向和距离,并输出一个新的纬度/经度对 [B] 这样,如果您从 [A] 点开始,并以给定的航向行进给定的距离,您将在 [B] 点结束.

What I need is a second function which, using the exact same model of the Earth's geometry, takes a single lat/lon pair [A], a heading, and a distance, and outputs a new lat/lon pair [B] such that if you started at point [A], and traveled the given distance at the given heading, you'd wind up at point [B].

这就是我的几何技能完全离开我的地方:)

This is where the fact that my geometry skills have left me entirely comes into play :)

任何帮助将不胜感激!

谢谢,-丹

推荐答案

我从 航空处方.

他给出的公式是:

点 {lat,lon} 的距离为 d从点 1 开始的 tc 径向如果:

Lat/lon given radial and distance

A point {lat,lon} is a distance d out on the tc radial from point 1 if:

 lat=asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
 IF (cos(lat)=0)
    lon=lon1      // endpoint a pole
 ELSE
    lon=mod(lon1-asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi
 ENDIF 

此算法仅限于 dlon < 的距离.pi/2,即那些延伸不到一周长的四分之一地球经度.一个完全一般,但更复杂如果更大,算法是必要的允许距离:

This algorithm is limited to distances such that dlon < pi/2, i.e those that extend around less than one quarter of the circumference of the earth in longitude. A completely general, but more complicated algorithm is necessary if greater distances are allowed:

    lat =asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
     dlon=atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat))
     lon=mod( lon1-dlon +pi,2*pi )-pi

请注意,他使用tc"表示真实航向(以北顺时针的弧度),他给出的距离是沿地球表面的弧度弧度.公式的第一部分对此进行了解释(以及从海里来回转换的公式).另外,请查看该页面上的实施说明"和工作示例".

Note that he's using "tc" to stand for true course (in radians clockwise from North) and the distances he gives are in radians of arc along the surface of the earth. This is explained (along with formulas to convert back and forth from nautical miles) in the first section of the Formulary. Also, check out the "Implementation Notes" and "Worked Examples" on that page.

这篇关于纬度/经度 + 距离 + 航向 -->纬度/经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆