如何可视化指向特定坐标(纬度、经度)的箭头,给定偏航角和偏航角
我想知道如何可视化指向某个坐标(纬度,经度)的箭头 当我拿着手机四处走动时。
我计算了所需位置的俯仰和偏航。现在我想知道如何在移动时一直指向这个位置。
问候,
I would like to know how to visualise an arrow pointing to a certain coordinates(latitude, longitude)
while I'm moving around holding my handset.
I'va calculated the pitch and yaw of the desired position. Now I want to know how to keep pointing to this position while moving.
Regards,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,您可以使用以下公式计算方位角(当地子午线与连接当前位置和从北方向测量的目标位置的大圆之间的角度):
请注意
lat1
,long1
、lat2
、long2
和bearing
均以弧度为单位。该公式假设地球是完美的球形。另请参阅此页面。要获得基于 WSG84 的更准确结果,您可以使用 android.location.Location 的
bearingTo()
< /a> 方法。然后,您可以使用指南针并在计算出的方位角处绘制箭头到南北线,或者您可以假设北方位于手机屏幕的顶部。如果您显示地图,第二种方法就很有意义,因为大多数人都习惯北在顶部。
In general you can calculate the bearing angle (the angle between your local meridian and the great circle connecting your current position and the target position measured from the north direction) using this formula:
Note that
lat1
,long1
,lat2
,long2
andbearing
are all in radians. The formula assumes perfectly spherical Earth. See also this page.For more accurate results based on WSG84 you can use android.location.Location's
bearingTo()
method.Then you can either use compass and draw the arrow at the computed bearing angle to the north-south line or you can assume the north to lie at the top of your phone's screen. The second approach makes a lot of sense if you display a map since most people are accustomed to having north at the top.