File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -64,26 +64,23 @@ def __init__(
6464 self ._flip = flip
6565
6666 def add_elevation_to_fig (self , fig , distance_traveled = 0.0 , color = "black" ):
67+
68+ distance = np .array (self .activity_stream ["distance" ].data ) * 1e-3
69+ elev = np .array (self .activity_stream ["altitude" ].data )
70+ distance , elev = fastrdp .rdp (distance , elev , epsilon = 0.1 )
71+
6772 if self .flip :
6873 dmax = self .activity_stream ["distance" ].data [- 1 ]
69- distance = (
70- np .array (
71- [dmax - dist for dist in self .activity_stream ["distance" ].data ]
72- )[::- 1 ]
73- * 1e-3
74- )
75- elev = np .array (self .activity_stream ["altitude" ].data )[::- 1 ]
74+ distance = np .array ([dmax - dist for dist in distance ])[::- 1 ]
75+ elev = elev [::- 1 ]
7676 else :
7777 distance = np .array (self .activity_stream ["distance" ].data ) * 1e-3
7878 elev = np .array (self .activity_stream ["altitude" ].data )
7979
80- x = distance + distance_traveled
81- y = elev
82- x_new , y_new = fastrdp .rdp (x , y , 0.1 )
8380 fig .add_trace (
8481 go .Scatter (
85- x = x_new ,
86- y = y_new ,
82+ x = distance ,
83+ y = elev ,
8784 mode = "lines" ,
8885 name = self .activity .name or f"Activity { self .activity .id } " ,
8986 line = dict (color = color ),
You can’t perform that action at this time.
0 commit comments