两个已知的 Android 地理位置之间的角度
我想找到两个已知地理位置之间的角度。基本上我想要的是,我想引导一个箭头,其尾点位于我当前的位置,箭头指向固定的地理位置。 所以我在想,如果以某种方式,我能够在这两个地理位置之间获得一个角度,那么我可能也能做到同样的事情。
你们有什么建议可以更好地做到这一点吗?任何帮助将不胜感激。
I want to find an angle between two known geolocations.Basically what I want is, I want to direct an arrow whose tail point is at my current location and arrow head is pointing towards a fixed geolocation.
So I am thinking if somehow, I am able to get an angle between these two geolocations then propably i will be able to do the same.
Do you guys have some suggestions to do it in a better manner. Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
参考这个,有几种方法解释。
如何计算方位角(向北的角度)两个 WGS84 坐标之间
Refer to this, there are several approaches explained.
How do I calculate the Azimuth (angle to north) between two WGS84 coordinates
我也想实现同样的目标。使用 this 引用计算角度,如下所示:
然后将 ImageView 旋转到该角度
I wanted to achieve the same. using this referance to calculate Angle as follows:
and then rotate ImageView to this angle
这确实是一个简单的三角函数。如果它们足够接近,您可以只使用平面几何。取这两个位置,找出以这两个位置为锐角的直角三角形,并计算。
已经有一个基本数学的链接。
一件事 - 如果位置相距很远,您将需要使用球面三角,否则角度将不准确。
嗯,有一个链接... http://www .easycalculation.com/trigonometry/triangle-angles.php
This is simple trig, really. If they're close enough together, you can just use plane geometry. Take the two locations, figure out the right triangle that has the two locations as the acute angles, and compute.
There's already a link to the basic math up.
One thing -- if the locations are very far apart, you'll want to use spherical trig or the angles will be inaccurate.
Well, there was a link ... http://www.easycalculation.com/trigonometry/triangle-angles.php
我不确定我是否理解你想要做什么,但请检查一下:
Android 参考,Location,distanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] results)
results 参数应该是浮点数数组 - 至少 2 个元素。然后在 results[0] 中您将找到距离,并在 results1 这两点之间的方位角。重要的是“距离和方位是使用 WGS84 椭球定义的。”
I'm not sure that I understand what you want to do, but check this:
Android Reference, Location, distanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] results)
results parameter should be array of floats - at least 2 elements. Then in results[0] you will find distance and in results1 bearing between this two points. What is important "Distance and bearing are defined using the WGS84 ellipsoid."