0
votes

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!

2
What's wrong with that? You should just define how many you want to use to determine the avg.William Melani

2 Answers

0
votes

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.

0
votes

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/