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

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

问题描述

因此:我有以下函数,根据网上找到的公式进行调整,它需要两个纬度/经度坐标,并以英里(沿着球形地球)的距离找到它们之间的距离:

  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]点结束。

这就是我的几何技能已经让我完全发挥作用的事实:)

任何帮助都将非常感谢!



感谢,
-Dan

解决方案

航空处方集 。他给出的公式是:


纬度/距离给定径向和距离



A点{lat,lon}是在
the tc上的距离d out如果满足以下条件,则从点1径向:

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

该算法仅限于dlon< pi / 2,即
,它们延伸至
地球的经度周长的不到1美元b的四分之一。一个完全
的一般,但更复杂的
算法是必要的,如果允许更大的
距离:

  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表示真实路线(以北向顺时针方向为弧度)以及他给出的距离沿着地球表面呈弧形弧度。这是在处方集第一部分解释的(连同从海里往返转换的公式)。另外,请查看该页面上的实施说明和工作示例。


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;
    }

As far as I can tell this works just fine.

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 :)

Any help would be much appreciated!

Thanks, -Dan

解决方案

I get most of those types of formulas from The Aviation Formulary.

The formula he gives is:

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 

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

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.

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

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