# Get rid of jumping GPS data with pykalman

I have gps data that I get from a smartphone application. Whenever the smartphone is stationary, the gps points are jumping. I understand that the signal is inaccurate due to the reception in a city between buildings and signal loss whenever inside.

From this post I wanted to give a shot to the Kalman filter. Using this article I was able to try out the Ramer-Douglas-Peucker algorithm on the latitude and longitude, and try the pykalman package for the elevation data. Also I have tried the pykalman example from the github project to play with the filter.

According to these readings, I assume to have the wrong input parameters :

``````measurements = numpy.column_stack([longitude_list, latitude_list])
# F_k : state transition matrix
F = numpy.array([ [1, 0],
[0, 1] ])

# H_k : the observation matrix
H = numpy.array([ [1, 0],
[0, 1] ])

# R : covariance R of delta_k observation noise N(0, R)
R = numpy.diag([1e-4, 1e-4])

kf = kf.em(measurements, n_iter=100)
(filtered_state_means, filtered_state_covariances) = kf.filter(measurements)
(smoothed_state_means, smoothed_state_covariances) = kf.smooth(measurements)
``````

The figures below are from matplotlib. The top left is with an iteration km.em(n_iter=2), top right with iteration 10, bottom left is iteration 50, bottom right is iteration 100. Whenever I try higher, I have a timeout. It does not seem that my filter work much on this case. Indeed the same shape is output (it might looks different at first because of the scale axis). How can I improve my stationary gps jumping data?

• Did you ever find a good solution for this kind of problem? – Georg Feb 13 '18 at 18:42