Lat/Lon + Distance + Heading --> Lat/Lon
因此:我具有以下功能,该功能根据在线找到的公式改编而成,该公式采用两个纬度/经度坐标,并以英里为单位(沿着球形地球)找到它们之间的距离:
1 2 3 4 5 6 7 8 9 10 11 12 | 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]点结束。
这就是我的几何技能完全让我离开的事实:)
任何帮助将非常感激!
谢谢,
-担
我从航空配方中获得了大多数这类配方。
他给出的公式是:
Lat/lon given radial and distance
A point {lat,lon} is a distance d out on
the tc radial from point 1 if:
1
2
3
4
5
6 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
ENDIFThis 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:
1
2
3 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"代表真实路线(从北向顺时针弧度),并且他给出的距离是沿地球表面的弧度弧度。 配方的第一部分对此进行了解释(以及从海里来回转换的公式)。 另外,请查看该页面上的"实施说明"和"有效示例"。