Android:如何使用 SensorManager.getAltitude(float p0, float p)?
我找到了使用 SensorManager 获取高度的替代方法,但它需要两个参数。
public static float getAltitude (float p0, float p)
Computes the Altitude in meters from the atmospheric pressure and the pressure at sea level.
p0 pressure at sea level
p atmospheric pressure
您能通过实际示例/代码片段教我们如何使用它吗?
更新1 我找到了 Web 服务提供商 (WSP) 网址来获取p0 海平面压力
。我已经成功获取了值,但不明白返回值。
WSP URL:http://avdata.geekpilot.net/
以下是东京国际机场 (http://avdata.geekpilot.net/weather/HND) 的示例输出
<weather>
<ident>RJTT</ident>
<error/>
<metar>
2011/09/22 08:00
RJTT 220800Z 04019KT 9999 -SHRA FEW012 BKN025 BKN040 21/18 Q1000 NOSIG
</metar>
<taf>
2011/09/22 04:12
TAF
AMD TAF
AMD RJTT 220409Z 2204/2306 08016KT 9999 FEW030 SCT050
BECMG 2204/2206 05014KT
TEMPO 2207/2209 36018G30KT SHRA
BECMG 2303/2306 10008KT
</taf>
</weather>
I found an alternative way to obtain altitude by using SensorManager but it requires two paramaters.
public static float getAltitude (float p0, float p)
Computes the Altitude in meters from the atmospheric pressure and the pressure at sea level.
p0 pressure at sea level
p atmospheric pressure
Would you teach us on how to use it by practical example/code snippet.
UPDATES1
I found web service provider (WSP) url to obtain the p0 pressure at sea level
. I have successfully get the value but don't understand the returned values.
WSP URL:http://avdata.geekpilot.net/
Here's the sample output for Tokyo International Airport (http://avdata.geekpilot.net/weather/HND)
<weather>
<ident>RJTT</ident>
<error/>
<metar>
2011/09/22 08:00
RJTT 220800Z 04019KT 9999 -SHRA FEW012 BKN025 BKN040 21/18 Q1000 NOSIG
</metar>
<taf>
2011/09/22 04:12
TAF
AMD TAF
AMD RJTT 220409Z 2204/2306 08016KT 9999 FEW030 SCT050
BECMG 2204/2206 05014KT
TEMPO 2207/2209 36018G30KT SHRA
BECMG 2303/2306 10008KT
</taf>
</weather>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
try
当前海平面气压 (QNH) 是metar 字段中“Q”后面的值(单位为 hPa - 百帕斯卡)。在本例中为 1000 hPa。
有关 TAF 和 METAR 的更多信息可以在维基百科上找到。
http://en.wikipedia.org/wiki/METAR
http://en.wikipedia.org/wiki/Terminal_aerodrome_forecast
The current barometric air pressure at sea level (QNH) is the value after the "Q" in the metar field (in hPa - hecto-Pascals). In this case 1000 hPa.
More info on TAF and METAR can be found on wikipedia.
http://en.wikipedia.org/wiki/METAR
http://en.wikipedia.org/wiki/Terminal_aerodrome_forecast