0

Using Windows Phone 7 and Bing maps I'm trying to draw a nice looking track from GPS coordinates. In WP7, the GPS is providing me with the latest data but it is not as accurate as I want. I would like to take the average of last 'X' measurements. The problem is that position data is longitude and latitude and I am not sure I can compute the proper average of the position: (longitude1 + longitude2)/2 , (latitude1 + latitude2)/2

Thanks!

TreyA
  • 3,339
  • 2
  • 20
  • 26
igal k
  • 1,883
  • 2
  • 28
  • 57

2 Answers2

0

I think what you are asking for is a smoothing of the data. I would suggest a simple low pass filter:

x_k = (1 - b) * x_k + b * x_(k-1)

EDIT: An example for latitude would be that x_k would be the current latitude from the GPS and x_(k-1) would be the previous value of latitude. The value of b is a percentage that you choose and you can tune b to get the desired smoothing. I would start with b = 0.2. Essentially, this will take 80% of the current latitude and add it to 20% of the previous latitude for the resultant x_k (display latitude) value.

TreyA
  • 3,339
  • 2
  • 20
  • 26
0

There are several ways to accomplish what you are looking for. The two most common algorithms is the Douglas-Puecker algrothim and Vertex Reduction. I personally preffer vertex reduction as it's simpler, faster and I find the results to be more visually appealing. I have a blog post on this method here: http://rbrundritt.wordpress.com/2011/12/03/vertex-reductionone-of-my-secret-weapons/

rbrundritt
  • 16,570
  • 2
  • 21
  • 46