Skip to content

Commit

Permalink
feat: elevation gain - keep: elevation & gpx type
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-29 committed Oct 29, 2023
1 parent abe1c46 commit 81fc614
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion run_page/keep_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def parse_raw_data_to_nametuple(
"end_local": datetime.strftime(end_local, "%Y-%m-%d %H:%M:%S"),
"length": run_data["distance"],
"average_heartrate": int(avg_heart_rate) if avg_heart_rate else None,
"total_elevation_gain": run_data["accumulativeUpliftedHeight"],
"map": run_map(polyline_str),
"start_latlng": start_latlng,
"distance": run_data["distance"],
Expand Down Expand Up @@ -211,14 +212,15 @@ def parse_points_to_gpx(run_points_data, start_time):
(point["timestamp"] * 100 + start_time)
/ 1000 # note that the timestamp of a point is decisecond(分秒)
),
"elevation": point.get("verticalAccuracy"),
"elevation": point.get("altitude"),
"hr": point.get("hr"),
}
points_dict_list.append(points_dict)
gpx = gpxpy.gpx.GPX()
gpx.nsmap["gpxtpx"] = "http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
gpx_track = gpxpy.gpx.GPXTrack()
gpx_track.name = "gpx from keep"
gpx_track.type = "running"
gpx.tracks.append(gpx_track)

# Create first segment in our GPX track:
Expand Down

0 comments on commit 81fc614

Please sign in to comment.