i researched a little in this topic, but there are many opinions that don't exactly give a clear image. My problem is this: I'm developing a gps-based app for Android, in wich i want to know distance between my current location specified by Androids LocationManager, and other location in real time. I tried Haversine formula, a Law of Cosines formula, then I discovered, that Android SDK gives me a simple function Location.distanceTo(Location) - i'm not sure what method does this function runs on. So, the point is, wich one will be good for me to use, in situations when real distance between these locations most of the time won't be larger than aprox. 100-200m? Maybe i should check Vincenty's formula? Is it realy that slow? Can someone please explain me what should I choose?
解决方案Don't use distanceTo. Use the distanceBetween method as it sounds like you already have the coordinates and that's all you need with this method: Location.distanceBetween() Javadoc
更多推荐
Android:计算两个位置之间距离的最佳方法
发布评论