【问题标题】:Geolocator and accuracy in Windows Phone 8Windows Phone 8 中的地理定位器和准确性
【发布时间】:2013-05-21 22:51:09
【问题描述】:

我有几个关于Geolocator 和财产DesiredAccuracy 的问题。

我有方法GetMyPosition

public async Task<Geoposition> GetMyPosition()
            {
                Geoposition myGeoposition = null;
                Geolocator myGeolocator = new Geolocator();
                myGeolocator.DesiredAccuracy = PositionAccuracy.High;
                try
                {
                    myGeoposition = await myGeolocator.GetGeopositionAsync();
                    return myGeoposition;
                }
                catch (Exception ex)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            MessageBox.Show("Can't get the position");

                        });
                    return null;
                }
            }

1) 为什么

Geolocator.DesiredAccuracy = PositionAccuracy.High;    
Geolocator.GetGeopositionAsync(); 

总是以 400 - 1600 m 的精度返回 Geoposition.Coordinate.PositionSource = Cellular(在诺基亚 Lumia 520 设备上)?

2)在什么设置下我可以得到高精度(50 - 100 m)和PositionSource = Satellite

3) 如果我的设备上有加载的地图,并且我在设备上激活了飞行模式,那么代码

 Geolocator myGeolocator = new Geolocator();
    myGeolocator.DesiredAccuracy = PositionAccuracy.High;
    try
    {
         myGeoposition = await myGeolocator.GetGeopositionAsync();
         return myGeoposition;
    }

会有用吗?没有手机,只有卫星?

4) 坐标精度有多强取决于设备?

提前致谢!

【问题讨论】:

    标签: windows-phone-7 geolocation windows-phone-8


    【解决方案1】:

    取自MSDN

    虽然定位服务使用多个位置信息来源,并且任何来源可能在任何给定时间都不可用(例如,可能无法访问 GPS 卫星或手机信号塔),但本机代码层会处理这项工作评估可用数据并选择最佳来源。您的应用程序需要做的就是在高精度或默认的功率优化设置之间进行选择。您可以在初始化主要位置服务类 GeoCoordinateWatcher 时设置此值。

    C#

    GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);

    因此,您似乎无法控制使用哪个源,而是将根据GeoCoordinateWatcher 上指定的位置精度使用可用源。尝试以高精度初始化GeoCoordinateWatcher,看看会发生什么

    var geoWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
    

    【讨论】:

    • 感谢您的回复!但我想使用新的地理定位 API。特别是对象地理定位器。我稍后会尝试 GeoCoordinateWatcher 并写下结果。
    • 设备(诺基亚 Lumia 520)在其他设备(HTC 8x)上的这个问题,没关系。
    【解决方案2】:

    你可以使用

    Geolocator myGeolocator = new Geolocator();
    myGeolocator.DesiredAccuracyInMeters = 20;
    ...
    

    明确说明您希望该位置有多准确,这将使设备能够更好地管理其电源,但您的结果是否接近该精度取决于设备可以获得的位置质量。例如,如果您在建筑物内,如果不连接 WIFI,您将无法获得如此准确的结果

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-29
      • 1970-01-01
      相关资源
      最近更新 更多