yihong0618 / running_page

Make your own running home page
https://running-page.vercel.app
MIT License
3.41k stars 978 forks source link

ValueError raised when syncing activities #547

Closed Haozhe-Li closed 7 months ago

Haozhe-Li commented 7 months ago

I download the .gpx file from strava directly and follow the instruction to run the python script to sync activities. Error throws:

only sync gpx files in GPX_OUT
GPX files: 1
load 1 tracks
+Traceback (most recent call last):
  File "/workspaces/run/run_page/gpx_sync.py", line 12, in <module>
    make_activities_file(SQL_FILE, GPX_FOLDER, JSON_FILE)
  File "/workspaces/run/run_page/utils.py", line 52, in make_activities_file
    activities_list = generator.load()
  File "/workspaces/run/run_page/generator/__init__.py", line 146, in load
    activity.summary_polyline = filter_out(activity.summary_polyline)
  File "/workspaces/run/run_page/polyline_processor.py", line 76, in filter_out
    new_pl = start_end_hiding(pl, IGNORE_START_END_RANGE)
  File "/workspaces/run/run_page/polyline_processor.py", line 58, in start_end_hiding
    ending_distance += haversine(polyline[i], polyline[i + 1])
  File "/usr/local/python/3.10.8/lib/python3.10/site-packages/haversine/haversine.py", line 219, in haversine
    _ensure_lat_lon(lat2, lng2)
  File "/usr/local/python/3.10.8/lib/python3.10/site-packages/haversine/haversine.py", line 93, in _ensure_lat_lon
    raise ValueError(f"Latitude {lat} is out of range [-90, 90]")
ValueError: Latitude 180.0 is out of range [-90, 90]

Not too sure why this happened. I try bunch of .gpx file downloaded from strata, and it seems that this problems occurs for no reason. p.s. the file itself should be ok cuz it views perfect on strata.

Thanks!

Haozhe-Li commented 7 months ago

I am viewing the .gpx file online, where all latitudes are within the valid range.

yihong0618 commented 7 months ago

can you use strava_sync? I will check your problem later today

Haozhe-Li commented 7 months ago

can you use strava_sync? I will check your problem later today

Appreciated. Still configuring the strava api. The same ValueError also throws for .fit outdoor run exported from Stryd. I'm trying to find the reason why these files crashed.

yihong0618 commented 7 months ago

will test my gpx today

yihong0618 commented 7 months ago

@Haozhe-Li Hi~ some questions

  1. did you use gpx_sync or fit_sync then crashed?
  2. can you share one file in this issue then we can check it, share it using attach here is OK( gpx file is better)
Haozhe-Li commented 7 months ago

@Haozhe-Li Hi~ some questions

  1. did you use gpx_sync or fit_sync then crashed?
  2. can you share one file in this issue then we can check it, share it using attach here is OK( gpx file is better)

Yep I tried them on gpx_sync.py and fit_sync.py. Since Github doesn't support .gpx attachment, please see the zip file. test.gpx.zip

Thanks a lot. This was the best project I've seen so far!

@

yihong0618 commented 7 months ago

@Haozhe-Li can you try pip install -U haversine then run gpx_sync again?

yihong0618 commented 7 months ago

@Haozhe-Li is that fix? If so I would close this issue

Haozhe-Li commented 7 months ago

@Haozhe-Li is that fix? If so I would close this issue

Sorry for the delay. I tried pip install -U haversine, but it was already there. Still in trouble with the gpx and fit file sync, but since I use strava sync now, so you might close it.

This problem could be due to my environment probably? I'm wondering if this gpx file works on your machine.

Haozhe-Li commented 7 months ago

@yihong0618

yihong0618 commented 7 months ago

@Haozhe-Li is that fix? If so I would close this issue

Sorry for the delay. I tried pip install -U haversine, but it was already there. Still in trouble with the gpx and fit file sync, but since I use strava sync now, so you might close it.

This problem could be due to my environment probably? I'm wondering if this gpx file works on your machine.

I use your gpx there is no problem in my si de

yihong0618 commented 7 months ago

closing it now, if we have this issue again, will open it, thanks for feedback