简体   繁体   English

如何从两个地方的经度和纬度获得一个地方到另一个地方的方向?

[英]how to get direction of one place to another from latitudes and longitudes of both place?

how to get direction of one place to another from latitudes and longitudes of both place? 如何从两个地方的经度和纬度获得一个地方到另一个地方的方向? as for example if source is Peru or Mexico and destination is Alaska then result should be around clockwise 45 degree north = anticlockwise 45 degree west. 例如,如果来源是秘鲁或墨西哥,目的地是阿拉斯加,则结果应为顺时针北45度=逆时针西45度。

i actually need a function that may return the result taking both lat lon of both source and destination.... 我实际上需要一个可以同时返回源和目标的纬度的结果的函数。

I am working in Android. 我正在使用Android。 But Here i just seek for the logic/calculation 但在这里我只是寻求逻辑/计算

Advance thanks 预先感谢

This formula will give you the initial heading to depart from the start point to the destination along a great circle: 该公式将为您提供沿大圆圈从起点到目的地的初始航向:

θ = atan2(sin(Δlong)*cos(lat2), cos(lat1)*sin(lat2) − sin(lat1)*cos(lat2)*cos(Δlong))

Where Δlong is the overall change in longitude from start to destination and lat1 , lat2 are the latitude of the start/destination. 其中Δlong是从起点到终点的经度的总体变化,而lat1lat2是起点/终点的纬度。

Note that the heading to the destination will change as you travel along the great circle, thus this heading would need to be continuously adjusted as you move toward the destination. 请注意,随着您沿着大圆圈行驶,前往目的地的航向将发生变化,因此,当您朝目的地移动时,将需要不断调整此航向。 Also note that you will need to map the angles returned by atan2() from +/- pi to 0-360°. 还要注意,您将需要将atan2()返回的角度从+/- pi映射到0-360°。

From: http://www.movable-type.co.uk/scripts/latlong.html 来自: http : //www.movable-type.co.uk/scripts/latlong.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 仅获取2个经度或2个纬度的距离(以英里为单位) - Get distances in miles for 2 longitudes or 2 latitudes only 我可以直接将目录从一个地方复制到另一个地方吗? - can i copy a directory from one place to another place directly? 将图像从一个地方移到另一个地方 - Move an image from one place to another 如何绘制从我的android应用发送到tomcat服务器的经度和纬度,并在该处的Google地图上进行绘制? - How can i plot the longitudes and latitudes sent from my android app to tomcat server and plot on the google maps there? 从两个坐标获取所有经度和纬度 - Getting all latitudes and longitudes from two co-ordinates Libgdx:将2位演员彼此放置 - Libgdx: place 2 actors one on another 为什么在一个地方却没有另一个地方定义“未定义唯一的bean”? - Why do I get a “No unique bean is defined” in one place, but not another? 无法使用Java代码将文件从一个地方传输到另一个地方 - Cannot transfer a file from one place to another using java codes 在Java中将可变数量的方法从一个地方复制到另一个地方 - Copying a variable number of methods from one place to another in Java 在JFrame中从一个位置移动到另一个位置的标签或任何组件 - A label or any component that moves from one place to another in JFrame
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM