GeoCoordinateWatcher - 提高准确性

时间:2014-06-10 20:29:57

标签: c# wpf coordinates

我开始在C#中使用GeoCoordinateWatcher。我的问题是,即使我将精度设置为高,但是当我需要它返回精确的坐标时,它只返回4位小数,这将是大约13位小数。有没有办法做到这一点?

以下是我的代码,感谢任何帮助:)

C#:

           GeoCoordinateWatcher watcher;
           public void GetLocationEvent()
            {
                this.watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
                watcher.MovementThreshold = 0;
                this.watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
                bool started = this.watcher.TryStart(false, TimeSpan.FromMilliseconds(2000));
                if (!started)
                {
                    MessageBox.Show("GeoCoordinateWatcher timed out on start.", "Error", MessageBoxButton.OK);
                }
            }

            void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
            {
                PrintPosition(e.Position.Location.Latitude, e.Position.Location.Longitude);
            }

            void PrintPosition(double Latitude, double Longitude)
            {
                CoordinatesLabel.Content = Latitude.ToString() + ", " + Longitude.ToString();
            }

0 个答案:

没有答案