remisalmon / gpx-interpolate

Python function to interpolate GPX data using piecewise cubic Hermite splines
MIT License
49 stars 12 forks source link

Speed calculation not exact enough in some cases #9

Closed goamberg closed 3 years ago

goamberg commented 3 years ago

Hi

When interpolating some data, in extreme cases with high frequency, the speed data gets a little too inaccurate. image This is a test with r 0.1, 0.2 and 0.5 The -d options does not matter in this and all produce roughly the same

Here is the testsample from the picture (at around 09:45:42) Output_01.txt Output_01_interpolated.txt

remisalmon commented 3 years ago

The steps in your speed graph are due to the time stamps being interpolated linearly to preserve monotonicity (delta_t is constant between 2 GPX locations) along the GPX spline, itself parametrized with a constant step defined with -d (delta_d constant everywhere). So speed = delta_d/delta_t = constant between 2 GPX locations is actually expected, regardless of the degree of the spline.

You can try to interpolate the time stamps with a higher order spline (like 'lat', 'lon' and 'ele') but you may run into negative time stamps/speed values.

goamberg commented 3 years ago

Thanks for the reply! I think I understand. We try to work around a little bit with a smoothing (moving ave) after the fact. Should be enough for our data