如何Android的GPS定位作品getAltitude()作品、Android、GPS、getAltitude

2023-09-06 02:52:29 作者:聘山河作礼

HI

我想实现一个简单的GPS跟踪器。因此,使用

I tried to implement a simple GPS tracker. Therefore is used

lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this);  

然后我用了

public void onLocationChanged(Location location) {

方法来读取我的当前位置的海拔高度。

method to read the altitude of my current location.

但我真的不知道该怎么Location.getAltitude()返回。该文件说,它返回的高度。但是,这是在米?或呎?如果我把手机放在办公桌上我旁边,500和-500之间的值发生变化?

But i dont really know what Location.getAltitude() returns. The document says it returns the altitude. But is this in meters? or feets? if i put the phone on the desk next to me, this value changes between 500 and -500??

这是如何真正发挥作用???

How does this really work???

推荐答案

你得到的高度值是米的GPS(WGS84 ) 参考椭球并没有从的大地水准面。

The altitude value you get is in meters from the gps (WGS84) reference ellipsoid and not from the geoid.

从我自己的经验,GPS是非常糟糕的高度值。

From my own experience the GPS are really bad at altitude values.

我读这在 GPS状态常见问题:

GPS不报告上述的平均海平面的高度,而在GPS系统的高度进行比较的WGS84参考椭球可以是高于或低于实际海平面。在地球的不同部分,可以通过超过200米(取决于地球的质量分布)关闭。例如佛罗里达州周围的大地水准面的表面上方受到良好的30-40米的平均海拔,这意味着站在岸边会告诉你-30m的高度。这是正常的,而不是错误,而所造成的事实,即高度是相对于人造基准表面而不是与海平面。如果你有兴趣这个主题,我建议阅读平均海平面,GPS和大地水准面。

GPS does not report the height above the mean sea level, rather the GPS system compares the height to the WGS84 reference ellipsoid which may be above or below the actual sea level. In different parts of the earth it can be off by more than 200 meters (depending on the mass distribution of Earth). For example the geoid's surface around Florida is above the mean sea level by a good 30-40 meters, which means that standing on the shore would show you -30m as altitude. This is normal, and not an error, and caused by the fact that the altitude is relative to an artificial reference surface and not to the sea level. If you are interested in this topic, I recommend to read Mean Sea Level, GPS, and the Geoid.