Wednesday 15 January 2014

c# - How to track distance accurately between two locations in windows phone using GPS? -


I'm working on the Location Tracking app The app is showing the current location in the beginning and it is displaying the wrong value later And the code is as follows. Tracking our line on the map pulls this line (animated line) and it shows the wrong path. Although the device is in a steady place, it is showing the wrong value, am I missing anything?

  // Code running a public partial square: phone application page {Private GeoCoordinateWatcher _watcher = new GeoCoordinateWatcher (GeoPositionAccuracy.High); Private mapplolines _lines; Private Dispatcher Timer _timer = New Dispatcher Timer (); Private long-time start time; Public Walk () {Initial Group (); _line = new mapPollline (); _line. Stroke color = color. _line. Troccacht = 5; Map.MapElements.Add (_line); _watcher.Start (); _timer.Start (); _startTime = System.Environment.TickCount; _watcher.PositionChanged + = Watcher_PositionChanged; _timer.Interval = Timespace.formsconds (1); _timer.Tick + = Timer_Tick; } Private Zero TimesTit (Object Sender, EventAGRS E) {TimeSpain Runtime = Timespan From Milliseconds (Systems Environmental Tickcant - _starttime); TimeLabel.Text = runTime.ToString (@ "hh \: mm \: ss"); } Private Double _Cilliometers; Personal long _preher situation Changtech; Watcher_PositionChanged (Object Sender, GeoPositionChangedEventArgs & lt; GeoCoordinate & gt; E) from Private Zero {var sync = New GeoCoordinate (e.Position.Location.Latitude, e.Position.Location.Longitude); If (_line.Path.Count> gt; 0) {var previous page = _line.Path.Last (); Var distance = coord.getdistanceTo (previous page); Var millisPerKilometer = (1000.0 / distance) * (System.Environment.TickCount - _previousPositionChangeTick); _kilometres + = Distance / 1000.0; Speed ​​labels Text = timespan From milliseconds (millisperkilometer). Ostring (@ "mm \: ss"); DistanceLabel.Text = string.Format ("{0: f2} km", _cilliometres); Calorie label Text = string Format ("{0: f0}", _Cilimateters * 65); Status handler handler = New position handler (); Var heading = handler CalculusBearing (new position (previous page), new position (coordination)); Map.setview (coordination, map zoom level, title, map animation key parabolic); } And {map.center = coord; } _line.Path.Add (coordinate); _previousPositionChangeTick = System.Environment.TickCount; There are "false values" within a few dozen meters of the original 

place? If so, what you are watching is just the inaccuracy of GPS.

GPS is not 100% accurate even if your device is not growing, then the place where the device's GPS thinks can actually change your calculation The location may not be based on the correct GPS, but on Wi-Fi or nearby cell towers (A-GPS), both of which are very less accurate.

See more information. For the purposes of debugging, I suggest you to display anywhere on your UI to see if the GPS is in line with expectations.

No comments:

Post a Comment