2012-07-28 67 views
0

我開發了一個應用程序來讀取windows phone 7上兩個位置之間的距離。但是,在測試應用程序時,無論何時移動幾釐米,它都會以13000的值提供值。在計算通過Windows Phone的釐米距離時遇到問題

Public Sub watcher1_PositionChanged(sender As Object, e As GeoPositionChangedEventArgs(Of GeoCoordinate)) 
    Dim dCoord As GeoCoordinate 
    Dim currentDistance As Double 
    Dim convertedDistance As Double 
    dCoord = New GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude) 

    If mlastCoordinate.Latitude <> 0.0 Then 

     'distanceText.Text = e.Position.Location.Latitude.ToString() 
     currentDistance = mlastCoordinate.GetDistanceTo(dCoord) 
     mDistance = startCoordinate.GetDistanceTo(dCoord) 
     ' mDistance += currentDistance 
     'mDistance = Math.Round(mDistance, 2) 
     'Dim distance As String 
     'distance = String.Format("%.2", mDistance) 
     If selectedSystemState.Equals("centi") Then 
      convertedDistance = mDistance * 100 
     ElseIf selectedSystemState.Equals("meter") Then 
      convertedDistance = mDistance 
     ElseIf selectedSystemState.Equals("inches") Then 
      convertedDistance = mDistance * 39.37 
     ElseIf selectedSystemState.Equals("feet") Then 
      convertedDistance = mDistance * 3.28 
     End If 

     convertedDistance = Math.Round(convertedDistance, 2) 

回答

0

你得到的距離is in meters。所以,13000釐米是130米 - 除非我們知道你的行動方式,這似乎是一個非常合理的價值。

0

如何實例化位置服務 - 如果您不使用GeoCoordinateWatcher(GeoPositionAccuracy.High),您可能會使用Cell Tower數據,該數據可能會丟失100多米。

即使您使用GPS,民用GPS裝置的精確度也只有5-10米,因此測量釐米或英寸的距離實際上超出了這些範圍。

您應該檢查GeoCoordinate.HorizontalAccuracy以查看「噪音」可能是什麼。