Location.distanceTo 在近似距离计算中使用 error 参数?
我想知道 Location.distanceTo 方法在近似位置时是否会使用 Location 对象的精度字段,或者我是否必须自己将错误添加到这些字段中。用途是将距离与接近值进行比较。
Float dist=currentLocation.distanceTo(loc2);
这是
if (dist<100meters)
或者
if (dist+currentLocation.getAccuracy()+loc2.getAccuracy()<100meters)
I am wondering if the Location.distanceTo method will use the accuracy field of the Location object when approximates the location, or do I have to add by my own the errors to these fields. The usage is to compare the distance against a proximity value.
Float dist=currentLocation.distanceTo(loc2);
Would this be
if (dist<100meters)
or
if (dist+currentLocation.getAccuracy()+loc2.getAccuracy()<100meters)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来它忽略了准确性:
https: //android.googlesource.com/platform/frameworks/base/+/donut-release/location/java/android/location/Location.java#400
It looks like it ignores accuracy:
https://android.googlesource.com/platform/frameworks/base/+/donut-release/location/java/android/location/Location.java#400