CoreLocation 的准确度测量有多准确
我一直在测试 CoreLocation 各个方面的准确性,并惊讶地发现传递给 CLLocationMangerDelegate 方法的新旧位置上提供的准确性值: (void)locationManager:didUpdateToLocation:fromLocation 本身非常不准确。
走在某些人行道上(沿着一侧有建筑物的一段道路),我发现虽然 CLLocationManager 声称它提供的 CLLocations 的水平精度为 5 米,但实际上 MKUserAnnotation 显示的位置可以达到距离我知道的位置 30 米(通常显示为一排建筑物的对面)。这表明准确度读数本身并不准确。 CLLocationManager 告诉我它的坐标精确到 5 米以内,但实际上最多有 30 米。
澄清一下,这不是缓存/时间戳问题,它在某些区域是可重复的,并且不会随着时间的推移而改善。
还有其他人遇到过这个问题吗?
I have been testing the accuracy of various aspects of CoreLocation and have been surprised to find the accuracy value supplied on new and old locations passed to the CLLocationMangerDelegate method: (void)locationManager:didUpdateToLocation:fromLocation is wildly inaccurate itself.
Walking certain stretches of pavement(along a stretch of road with buildings along one side) I have found that whilst CLLocationManager claims the CLLocations it is supplying have a horizontal accuracy of 5 meters, in actual fact the position shown by the MKUserAnnotation is anything up to 30 meters away from the position I know I'm in (often showing as being the opposite side of a row of buildings). This suggests that the accuracy reading itself is not accurate. CLLocationManager is telling me its coordinates are accurate to within 5 meters but are actually as many as 30 meters out.
To clarify, this is not a caching/timestamp issue It is repeatable in certain areas, and not something that improves over time.
Has anyone else encountered this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CoreLocation 不是人类,也不知道您“真正”在哪里,这是您问题答案的本质。它使用您设备上的传感器并为您提供它所获得的最佳答案,而其了解其所声称答案的准确性的能力存在问题,这反映出定位问题本质上是非常困难的。
离题一下位置数据本身:CoreLocation 根据蜂窝塔三角测量、附近的 SSID 以及最后的 GPS 来确定设备的位置。这些确实具有不同程度的准确性,但它们的共同点是,如果您让设备工作更长时间,您将得到更准确的答案。然而,由于 CoreLocation 使用的所有工具在电池寿命方面都很昂贵,因此一旦生成满足“足够好”标准的答案,它就会停止。
这就是为什么另一个答案告诉您 将您的desiredAccuracy设置为
kCLLocationAccuracyBestForNavigation
- 当您这样做时,您基本上是在告诉 CoreLocation“向我展示您拥有的最好的产品”,并且您还自愿承担随之而来的 CPU 负载、时间和电池消耗那。您还偏离了 CoreLocation 用于确定什么是“足够好”的正常范围 - 不是提前告诉它什么时候可以停止,而是基本上说“我会告诉您什么时候它足够好”。因此,CoreLocation 将继续尝试为您提供更好的答案,直到您告诉它您已完成,并且您需要履行决定该点是什么的责任。这也是您需要记住的地方,CoreLocation 的工具的精确度是有限的 - 您可以获得大量的纬度和经度有效数字,但要冒险超出范围,您自愿承担了确定这些数字的可信度的任务。预定义的精度等级为 10 米、100 米、1 公里和 3 公里。 CoreLocation 的创建者选择这些分界点的事实应该告诉您问题的难度 - 如果提高准确性很容易,那么它可能已经在框架中了。
所以回过头来:CoreLocation 忠实地报告了其答案的准确性,只是这些答案背后的数据有问题,如果它更多地了解其准确性声明的准确性,它会在其准确性声明中反映这一点。考虑这样一种假设情况:CoreLocation 确切地知道其准确度声明的准确度,然后是 CoreLocation 对其准确度声明的准确度一无所知的情况,并考虑如何设计 API 来解决该问题。 CoreLocation 非常确定,因为它可以合理地确定它的确定程度,如果您能在硬件限制内找出一种易于处理的方法来更加确定您的确定程度,那么 App Store 的财富就在等待着您你。
CoreLocation is not a human and does not know where you "really" are, is the essence of the answer to your question. It is using the sensors on your device and giving you the best answer it's got, and the problems with its ability to know the accuracy of its claimed answer, reflect that the problem of location is inherently very difficult.
To digress into the location data itself: CoreLocation draws from cell tower triangulation, nearby SSIDs, and finally GPS, to determine the device's location. These do have varying degrees of accuracy, but what they have in common is that if you let the device work for longer, you'll get a more accurate answer. However, because all of the tools that CoreLocation uses are expensive in terms of battery life, it will stop as soon as it has generated an answer that meets your criteria for "good enough."
This is why another answer told you to set your desiredAccuracy to
kCLLocationAccuracyBestForNavigation
- when you do that, you're basically telling CoreLocation "show me the best you've got," and you've also volunteered for the CPU load, time, and battery drain that come with that. You've also gone off the normal scale that CoreLocation uses to figure out what's "good enough" - instead of telling it ahead of time when it can stop, you've basically said "I'll tell you when it's good enough."CoreLocation will thus keep on trying to give you better answers until you tell it you're done, and you need to carry out your responsibility for deciding what that point is. This is also where you need to bear in mind that there are limits to how accurate the tools in CoreLocation's repertoire can be - you can get lots of significant digits of latitude and longitude, but by venturing off the scale, you've volunteered for the task of figuring out how trustworthy those numbers are. The pre-defined scales of accuracy are 10 meters, 100 meters, 1 km, and 3km. The fact that the creators of CoreLocation chose those cut-off points should tell you something about the difficulty of the problem - if better accuracy were easy, it would probably already be in the framework.
So circling back around: CoreLocation is reporting the accuracy of its answers faithfully, it's just that the data underlying those answer is problematic, and if it knew more about the accuracy of its accuracy claims, it would reflect that in its accuracy claims. Consider the hypothetical situation where CoreLocation knows exactly how accurate its accuracy claims are, then the situation where CoreLocation knows nothing about how accurate its accuracy claims are, and consider how you'd design an API to account for the problem. CoreLocation is as sure as it can reasonably be about how sure it is, and if you can figure out a tractable-within-the-limits-of-the-hardware way to be more sure about how sure you are, App Store wealth awaits you.
硬件需要一些时间才能获得准确性。最佳精度为 2-3 秒内 65m。否则你有1414m的精度
the hardware takes some time to get the accuracy. the best accuracy is 65m in 2-3 seconds. else u have 1414m accuracy