简体   繁体   English

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

[英]GPS to calculate distance between two points on windows phone 7

i am using GPS to calculate distance between two points ie i am using windows phone as a tape measure but when i start i dont get the correct value infact even if i am standing still it gives me hundreds of meter 我正在使用GPS计算两点之间的距离,即我使用Windows手机作为卷尺,但是当我开始我没有得到正确的值,即使我站着不动它给我数百米

here is my code 这是我的代码

      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";
                }
        }

    }

At best, a GPS is only accurate to 3 meters. 充其量,GPS只能精确到3米。 The more likely error is 5 - 10 meters. 更可能的错误是5-10米。

You're going to have to augment your GPS readings to get better accuracy. 您将不得不增加 GPS读数以获得更好的准确度。

so far accuracy is not an issue. 到目前为止,准确性不是问题。 i run this app and the reading at current location changes continuously while i have set movementthreshold to 1 means 1 meter of distance needs to be covered to call PositionChanged event but reading keeps on changing even though i am still 我运行这个应用程序并且当前位置的读数连续变化,而我已将movingthreshold设置为1意味着需要覆盖1米的距离来调用PositionChanged事件但是即使我仍然仍在阅读

The other posters here are generally correct: GPS will not give you the accuracy you need. 这里的其他海报通常是正确的:GPS不会给你所需的准确性。 At least not alone! 至少不是一个人!

Assuming you did have a good satellite fix, you could get an accuracy of centimeters, but this would require post-processing with information from special fixed stations or a live feed of data from such a station. 假设你确实有一个很好的卫星定位,你可以获得厘米的精度,但这需要使用来自特殊固定站的信息或来自这样一个站的数据的实时馈送进行后处理。 The buzzwords here are "real-time phase differential", "real-time kinematic", "phase-differential post-processing". 这里的流行语是“实时相位差”,“实时动态”,“相位差分后处理”。

This site has some details. 这个网站有一些细节。

So, if you can get access to feed, it may be possible. 所以,如果你可以访问饲料,它是可能的。 But it will not be as easy as you probably hoped. 但它并不像你希望的那么容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM