gpt4 book ai didi

c# - GPS计算Windows Phone 7上两点之间的距离

转载 作者:行者123 更新时间:2023-11-30 17:08:20 24 4
gpt4 key购买 nike

我正在使用 GPS 来计算两点之间的距离,即我正在使用 Windows Phone 作为卷尺,但是当我开始时,即使我站着不动,我也没有得到正确的值,它给了我几百米

这是我的代码

      myWatcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(myWatcher_StatusChanged);
myWatcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(myWatcher_PositionChanged);
myWatcher.MovementThreshold = 1;

void myWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
double tempf = e.Position.Location.Latitude;
double temps = e.Position.Location.Longitude;
if (count2 == 0)
{
FirstLocation = new GeoCoordinate(tempf, temps);
count2++;
}
else
{
double distanceInMeter;
GeoCoordinate currentLocation;
currentLocation = new GeoCoordinate(tempf, temps);
distanceInMeter = currentLocation.GetDistanceTo(FirstLocation);

if (App.flag == 0)
{
textBlock1.Text = distanceInMeter.ToString() + " m";
double distanceInCm = distanceInMeter * 100;
textBlock2.Text = distanceInCm .ToString() + " cm";
}
else if (App.flag == 1)
{
double distanceInInch = distanceInMeter * 39.3701;
textBlock1.Text = distanceInInch.ToString() + " in";
double distanceInFoot = distanceInMeter * 3.28084;
textBlock2.Text = distanceInFoot.ToString() + " ft";
}
}

}

最佳答案

GPS 充其量只是 accurate到 3 米。更可能的错误是 5 - 10 米。

你将不得不 augment您的 GPS 读数以获得更高的准确性。

关于c# - GPS计算Windows Phone 7上两点之间的距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13825963/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com