Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add speed to gpx if missing #53

Closed
FlorianWilhelm opened this issue Feb 5, 2016 · 1 comment
Closed

Add speed to gpx if missing #53

FlorianWilhelm opened this issue Feb 5, 2016 · 1 comment

Comments

@FlorianWilhelm
Copy link

First of all gpxpy is really great and I like that I can add the elevation so easily to a track with the help of srtm.py. I would be cool to have this feature also for the speed. There is get_moving_data that actually calculates what I want but does not return it. A function add_missing_speed would be nice that calculates and adds the smoothed speed to all the GPXTrackPoint points. A simple way of smoothing would be to assign the calculated speed from time and distance to the center of the line between to GPXTrackPoints. The speed at a GPXTrackPoint is now the weighted speed of the two adjoining lines. For the first and last GPXTrackPoint one would need to assume 0 or a cyclic boundary condition.

@tkrajina
Copy link
Owner

tkrajina commented Feb 6, 2016

Yes, I agree. I don't have the time to implement this properly now, but if you want to experiment, I just pushed a quick idea. It's in 7032e0f (branch: add-missing-speed). In the _add(...) function interval should contain points without .speed, start and end are points with .speed before and after the interval.

This (if it works) should only add missing speeds and it is not especially smart.

The smoothing should maybe be done in smooth() by changing:

    def smooth(self, vertical=True, horizontal=False, remove_extremes=False):

to:

    def smooth(self, vertical=True, horizontal=False, remove_extremes=False, speed=False):

And then implementing it in there.

@tkrajina tkrajina closed this as completed Mar 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants