我使用GPS兩點之間計算距離,即我使用Windows手機作爲一個捲尺,但是當我開始我沒有得到正確的值INFACT即使我站在它仍然給了我幾百米GPS到Windows Phone上的兩點之間計算距離7
這裏是我的代碼
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";
}
}
}
作爲一個捲尺變化1米的距離呢? *最好的情況下,gps只能精確到8米左右。如果你使用塔式輔助GPS而不是真正的GPS,那麼100米是最好的情況。 –
到目前爲止準確性不是問題。我運行這個應用程序和當前位置的閱讀不斷變化,而我已經設置了移動閾值爲1意味着需要覆蓋1米的距離調用PositionChanged事件,但閱讀不斷改變,即使我仍然 – Hamza
你怎麼能說「準確率是不是一個問題「,如果你的整個問題是關於準確性?如果任何單獨的GPS測量僅在3米範圍內(最好!),距離*完全相同的地方*的任何2個測量值可能(最好!)相隔6米!再一次,**最好**。 gps最適合測量星球*上的距離,而不是*紙*上。 –