Android 中如何测量定位精度?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3052517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How is location accuracy measured in Android?
提问by John R.B. Palmer
Does anyone know the proper interpretation of the accuracy measurements returned by getAccuracy()? For instance, are they calculated as:
有谁知道 getAccuracy() 返回的准确度测量值的正确解释吗?例如,它们是否计算为:
Circular Error Probability (meaning, if i understand correctly, radius of a 50% confidence circle)?
Radius of 95% confidence circle?
something else?
圆误差概率(意思是,如果我理解正确,50% 置信圆的半径)?
95% 置信圆的半径?
还有什么?
In addition, what are the actual calculations that are used and how much can we rely on them? Does it depend on the source of the location estimate (GPS vs. network)?
此外,实际使用的计算是什么,我们可以依赖它们多少?它是否取决于位置估计的来源(GPS 与网络)?
Many thanks for any advice you can give me.
非常感谢您给我的任何建议。
采纳答案by karl
To answer one part of the question, the number is the radius of 68% confidence,
meaning that there is a 68% chance that the true location is within that radius of the measured point in meters. Assuming that errors are normally distributed (which, as the docs say, is not necessarily true), that means that this is one standard deviation. For example, if Location.getAccuracy
returns 10, then there's a 68% chance the true location of the device is within 10 meters of the reported coordinates.
为了回答问题的一部分,该数字the radius of 68% confidence,
意味着真实位置在以米为单位的测量点半径内的可能性为 68%。假设错误是正态分布的(正如文档所说,不一定正确),这意味着这是一个标准偏差。例如,如果Location.getAccuracy
返回 10,则设备的真实位置在报告坐标的 10 米内的可能性为 68%。
http://developer.android.com/reference/android/location/Location.html#getAccuracy()
http://developer.android.com/reference/android/location/Location.html#getAccuracy()
回答by vendor
The location is a tricky task to do, when you have a limited battery life and when there is no GPS signal in buildings and in areas with many big building and etc. But Android makes it a much easier. When you request a location, you just have to specify what accuracy do you need.
定位是一项棘手的任务,当您的电池寿命有限并且建筑物和具有许多大型建筑物等的区域没有 GPS 信号时。但 Android 使它变得更容易。当您请求位置时,您只需要指定您需要的准确度。
If you specify that you want an accuracy
for an example *100 meters*
, Android will try to get the location and if it can get a location for accuracy 70 meters, it will return it to you, but if Android can get a location with an accuracy higher than 100 meters, your application will wait and will not receive anything till there is a location in such accuracy.
accuracy
例如*100 meters*
,如果您指定您想要一个位置,Android 将尝试获取位置,如果它可以获取 70 米精度的位置,它将返回给您,但如果 Android 可以获取精度高于 100 的位置米,您的应用程序将等待并且不会收到任何内容,直到有如此精确的位置。
Typically Android will first get the Cell ID and then will send it to Google server, which maps such Cell IDs and the server will return a latitude and longitude with an accuracy which is low for an example 1000 meters. By this time Android will also try to see all WiFi networks in the area an will send information about them too to the Google server and if possible Google server will return a new location with higher accuracy for an example 800 meters.
通常,Android 将首先获取 Cell ID,然后将其发送到 Google 服务器,该服务器映射此类 Cell ID,服务器将返回纬度和经度,精度较低,例如 1000 米。届时,Android 还将尝试查看该区域内的所有 WiFi 网络,并将有关它们的信息也发送到谷歌服务器,如果可能,谷歌服务器将以更高的精度返回一个新位置,例如 800 米。
By this time the GPS will be on. The GPS device needs at least 30 seconds from a cold start to get a fix, so if can get a fix it will return latitude and longitude but again with an accuracy, which will be the highest possible for an example 100 meters. The longer the GPS works, the better accuracy you will get.
此时 GPS 将开启。GPS 设备从冷启动开始至少需要 30 秒才能得到修复,因此如果可以得到修复,它将返回纬度和经度,但同样具有精度,例如 100 米,这将是可能的最高值。GPS 工作的时间越长,您获得的准确度就越高。
Important notice:The first two methods requires an internet connection. If there is no data connection, you will have to wait for the GPS, but if the device is in a building, you will probably get no location.
重要提示:前两种方法需要互联网连接。如果没有数据连接,您将不得不等待 GPS,但如果设备在建筑物中,您可能无法获得位置。
回答by Janusz
The documentation on getAccuracysays that it returns the accuracy in meters. I would guess that this means if you get a return value of 60 you are somewhere in a circle with a 60 meter radius around the supplied position.
getAccuracy上的文档说它以米为单位返回精度。我猜这意味着如果你得到 60 的返回值,你就在一个圆中的某个地方,在提供的位置周围有 60 米的半径。
回答by paracycle
As far as I can see from a quick glance at the Android source code, this is dependent on the hardware of the device and what value it chooses to return.
就我快速浏览 Android 源代码所见,这取决于设备的硬件以及它选择返回的值。
The GpsLocationProvider.java
file has a reportLocation
methodwhich gets called by the native code and gets passed the accuracy as a value. Thus, no calculation seems to be happening in the framework at least.
该GpsLocationProvider.java
文件有一个reportLocation
方法,该方法由本机代码调用并将准确度作为值传递。因此,至少在框架中似乎没有进行计算。
The qcom (which I believe is the Qualcomm) GPS git repo is passingthe hor_unc_circular
parameter for accuracy which seems to imply that, at least, that implementation is using CER.
该QCOM(我认为这是高通)GPS混帐回购协议是路过的hor_unc_circular
,这似乎暗示,至少,实现使用CER的准确性参数。
回答by Joseph Earl
If, as quoted it in the docs, it is an accuracy, then the users actual position is somewhere within QUOTED_LOCATION +/- ACCURACY. So the accuracy defines a radius where you could expect the user to be. What the docs don't say is how sure you can be that the user is within radius - the standard is 95% so I guess this it.
如果,正如文档中引用的那样,它是准确的,那么用户的实际位置在 QUOTED_LOCATION +/- ACCURACY 内的某个位置。因此,精度定义了您可以预期用户所在的半径。文档没有说的是您可以确定用户在半径范围内 - 标准是 95%,所以我猜是这样。
回答by dscheffy
I get that you're asking for a definite answer in terms of probability, but I think there are two things to consider here.
我知道您是在寻求概率方面的明确答案,但我认为这里有两件事需要考虑。
First off, it's up to the provider to decide what they want to put in this value, so depending on the provider, it may just be a bad guess.
首先,由提供者决定他们想在这个值中放入什么,所以根据提供者的不同,这可能只是一个错误的猜测。
Secondly, it may help to think of this as a potential rounding problem. If I'm trying to calculate your location based on a number of inputs, and some of those inputs are only available to a certain number of significant digits, then it's only possible to calculate a location with a given number of significant digits.
其次,将其视为潜在的舍入问题可能会有所帮助。如果我试图根据多个输入来计算您的位置,而其中一些输入仅适用于特定数量的有效数字,则只能计算具有给定有效数字数量的位置。
Think of it this way -- what's "about" one plus "about" one hundred. Probably about one hundred, because the accuracy of one hundred is likely less than the magnitude of 1. If I suddenly say the answer is about 101, then I may end up implying a level of accuracy that wasn't there. However, if I actually specify the accuracy, then I can say that it 100 plus or minus 10 plus 1 plus or minus .1 is 101 plus or minus 10. I get that this is generally referring to something like a 95% confidence level (standard error), but again, that all assumes the provider understands statistics and isn't just guessing.
这样想——“大约”一加“大约”一百是什么意思。可能大约是一百,因为一百的准确度可能小于 1 的数量级。如果我突然说答案是大约 101,那么我最终可能暗示的准确度水平并不存在。但是,如果我真的指定了准确度,那么我可以说它是 100 正负 10 加 1 正负 .1 是 101 正负 10。我知道这通常指的是 95% 的置信水平(标准错误),但同样,所有这些都假设提供者了解统计数据,而不仅仅是猜测。