如何从 GPS LocationManager 获取 HDOP 或 VDOP 值?
如何从 GPS LocationManager 获取HDOP 或 VDOP 值?
How do I get the HDOP or VDOP values from the GPS LocationManager?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
GPS_Location:
Horizontal_Accuracy:
HDOP:
The GPS_Location:
The Horizontal_Accuracy:
The HDOP:
要获取 HDOP、VDOP、PDOP、DGPSID 和 GEOFDGPSDATA,请使用 GpsStatus.NmeaListener 并实现
onNmeaReceived()
从 适用于 Android 的轻量级 GPS 记录应用程序
To get HDOP, VDOP, PDOP, DGPSID and AGEOFDGPSDATA Use GpsStatus.NmeaListener and implement
onNmeaReceived()
find the implementation from Lightweight GPS Logging Application For Android
您可以从 GpsStatus 对象中的 GpsSatellite 对象获得 DOP 值的粗略估计(从技术上讲,它是原始值)。这使得您不需要解析 NMEA 字符串,您不仅可以获得 H(水平)、V(垂直)和 P(位置)DOP;您还可以获得 N(orth)、E(ast)、T(ime) 和 G(eometric) DOP。
对于每个 GpsSatellite 对象,您需要获取仰角、方位角、usedInFix 和 snr。
首先过滤掉所有卫星,仅保留 snr>0 且usedInFix==true 的卫星。
为每个卫星创建一个矩阵,其中每个卫星代表矩阵中的一行(表示为双精度数组)来创建我们称为 A 的矩阵:
注意:要使其正常工作,您需要至少 4 颗卫星
el=以弧度为单位的仰角
az=以弧度为单位的方位角
Sv=GpsSatellites 的集合
A[n]={sin(Sv[n].az)*cos(Sv[n].el), cos(Sv[n].az)*cos(Sv[n].el), sin(Sv[ n].el), 1d}
有趣的部分来了
DOP 矩阵方程如下
At = 转置矩阵 A
(At*A)^-1 = inverse(transpose(A).times(A)) =
显而易见DOP:
EDOP = sqrt(EDOP^2)
NDOP = sqrt(NDOP^2)
VDOP = sqrt(VDOP^2)
TDOP = sqrt(TDOP^2)
导出的 DOP:
GDOP = sqrt(EDOP^2+NDOP^2+VDOP) ^2+TDOP^2)
HDOP = sqrt(EDOP^2+NDOP^2)
PDOP = sqrt(EDOP^2+NDOP^2+VDOP^2)
You can get a rough estimate (technically it's the raw value) of the DOP values from GpsSatellite objects in the the GpsStatus object. This makes it so you do not need to parse the NMEA strings and you can not only get the H(orizontal),V(ertical), and P(ositional) DOPs; you can also get the N(orth),E(ast),T(ime),and G(eometric) DOPs.
For each of the GpsSatellite objects you'll want to get the elevation,azimuth,usedInFix,and snr.
First filter out all of the satellites only keeping the satellite the where the snr>0 and usedInFix==true.
For each satellite create a matrix where each satellite represents a row in the matrix (represented as an array of doubles) to create the Matrix we'll call A:
Note: for this to work properly you need at least 4 satellites
el=elevation in radians
az=azimuth in radians
Sv=the collection of GpsSatellites
A[n]={sin(Sv[n].az)*cos(Sv[n].el), cos(Sv[n].az)*cos(Sv[n].el), sin(Sv[n].el), 1d}
here comes the fun part
The DOP matrix equation is as follows
At = the trasnposed Matrix A
(At*A)^-1 = inverse(transpose(A).times(A)) =
obvious DOPs:
EDOP = sqrt(EDOP^2)
NDOP = sqrt(NDOP^2)
VDOP = sqrt(VDOP^2)
TDOP = sqrt(TDOP^2)
derived DOPs:
GDOP = sqrt(EDOP^2+NDOP^2+VDOP^2+TDOP^2)
HDOP = sqrt(EDOP^2+NDOP^2)
PDOP = sqrt(EDOP^2+NDOP^2+VDOP^2)
准确度通常是指 GPS 定位的 HDOP班级。但是,如果您想要两者,您可以尝试 NmeaListener 来获取原始 NMEA 字符串并解析它以获得 HDOP 和 VDOP。
Accuracy usually refers to HDOP for GPS in location class. However in case you want both you can try NmeaListener to get the raw NMEA string and parse it to get HDOP and VDOP.
您需要注册一个
NMEAListener
并尝试解析GSA
句子(包含HDOP、VDOP和PDOP)或GGA
句子(包含HDOP)进行修复)。请参阅 NMEA 0183 标准了解更多信息。
You need to register an
NMEAListener
and try to parse theGSA
sentence (contains HDOP, VDOP and PDOP) or theGGA
sentence (which contains HDOP for a fix).Refer to NMEA 0183 standard for more info.