From 81fc61446777364650b16e50331d7357952d2b2a Mon Sep 17 00:00:00 2001 From: ben_29 Date: Sun, 29 Oct 2023 23:34:54 +0800 Subject: [PATCH] feat: elevation gain - keep: elevation & gpx type --- run_page/keep_sync.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run_page/keep_sync.py b/run_page/keep_sync.py index 80323c9b9e9..7f45f47fcc8 100755 --- a/run_page/keep_sync.py +++ b/run_page/keep_sync.py @@ -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"], @@ -211,7 +212,7 @@ 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) @@ -219,6 +220,7 @@ def parse_points_to_gpx(run_points_data, start_time): 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: