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

Some Front Optimization for Keep indoor data #709

Merged
merged 6 commits into from
Sep 5, 2024

Conversation

houfeng0923
Copy link
Contributor

@houfeng0923 houfeng0923 commented Sep 3, 2024

hi , yihong
I export some keep records , almost indoor run data 🫣.
the geoPoints is empty or looks incomplete decoded data,
i prefer the bounds is dalian(from location_country) not beijing.

btw the part of the keep data is :

  {
    "run_id": 9223370384358951307,
    "name": "VirtualRun from keep",
    "distance": 7095.168620939273,
    "moving_time": "21:28:40",
    "type": "VirtualRun",
    "start_date": "2022-05-13 05:08:24",
    "start_date_local": "2022-05-13 13:08:24",
    "location_country": "{'latitude': 38.858706, 'longitude': 121.52418, 'country': '\u4e2d\u56fd', 'nationCode': '156', 'province': '\u8fbd\u5b81\u7701', 'city': '\u5927\u8fde\u5e02', 'cityCode': '0411', 'district': None, 'districtCode': None, 'startLatitude': 0.0, 'startLongitude': 0.0}",
    "summary_polyline": "gqqrFsrkeU??", // or null
    "average_heartrate": null,
    "average_speed": 0.09176369142446034,
    "streak": 1
  }

if "summary_polyline" === "gqqrFsrkeU??", decoded coord is beijing.

Copy link

vercel bot commented Sep 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
running-page ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 4, 2024 2:39am

@houfeng0923 houfeng0923 changed the title Some Front Optimize for Keep indoor data Some Front Optimization for Keep indoor data Sep 3, 2024
@@ -119,6 +137,7 @@ const locationForRun = (
}
if (provinceMatch) {
[province] = provinceMatch;
coordinate = extractCoordinate(location);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add some comments here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep的导出数据项location_country 中包含city的坐标
假如 存在province,尝试提取这个坐标保存。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯嗯,可以加在代码里么?因为这个是针对 keep 的所以加个注释好点~

@@ -158,6 +179,12 @@ const pathForRun = (run: Activity): Coordinate[] => {
? [arr[1], arr[0]]
: gcoord.transform([arr[1], arr[0]], gcoord.GCJ02, gcoord.WGS84);
});
if (c.length === 2 && String(c[0]) === String(c[1])) {
const { coordinate } = locationForRun(run);
if (coordinate?.[0] && coordinate?.[1]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

解析runpath,如果仅有两个相同的坐标点(没有路径,只是一个坐标点),尝试替换为 location中记录的 city坐标。
ps: keep中室内跑步数据提取到的runpath 是北京或国家坐标点(可能是无坐标时的默认值)。 location 记录的是 更具体的城市坐标(如果有)。

如果更严谨的话,需要分析替换前后坐标,哪个更具体使用哪个。

@@ -232,6 +259,9 @@ const getBoundsForGeoData = (
if (points.length === 0) {
return { longitude: 20, latitude: 20, zoom: 3 };
}
if (points.length === 2 && String(points[0]) === String(points[1])) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

调整路径只有一个点时的缩放级别,大概为市区级。

Copy link
Owner

@yihong0618 yihong0618 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yihong0618 yihong0618 merged commit 1868ade into yihong0618:master Sep 5, 2024
5 checks passed
@yihong0618
Copy link
Owner

Thanks

Kugin pushed a commit to Kugin/running_page that referenced this pull request Sep 13, 2024
* fix: use specific version match lockfileVersion

* chore: slient stderr

* fix: heartRates is  in keep run data

* chore: spell

* refactor: use city coord instead country coord (keep indoor data has incomplete geoPoints)

* Update utils.ts
ben-29 added a commit to ben-29/workouts_page that referenced this pull request Sep 29, 2024
* refs/heads/upstream:
  feat: fix nrc Changed their apis (yihong0618#718)
  feat: conditionally output analysis JS only in Vercel environment (yihong0618#715)
  ignore the year which has no running data when drawing github.svg (yihong0618#712)
  Fix AttributeError in Activity class (yihong0618#714)
  doc: fix typo close yihong0618#704
  Some Front Optimization for Keep indoor data (yihong0618#709)
  Add new runner (yihong0618#707)
  feat: adding illustration for special tracks  (yihong0618#705)

# Conflicts:
#	run_page/generator/__init__.py
#	run_page/joyrun_sync.py
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

Successfully merging this pull request may close these issues.

2 participants