flopp / GpxTrackPoster

Create a visually appealing poster from your GPX tracks
MIT License
429 stars 51 forks source link

Error while loading .../.gpx: Something went wrong when loading GPX #102

Open parthdesai97 opened 2 years ago

parthdesai97 commented 2 years ago

Getting an error when I run the following command:

create_poster --type grid --title "Strava Routes" --athlete "NAME"

I am running the command from a directory that contains all my .gpx files. Any idea why this is happening?

This is the error (it prints one time in terminal for each .gpx file):

Error while loading /Users/../Downloads/export_54211749/activities/5138491472.gpx: Something went wrong when loading GPX.

joetimmerman commented 2 years ago

Hi @parthdesai97 -- if you're still have this problem, it might be worth running with verbose logging enabled to see if that tells you anything interesting. You could also try parsing one of those files via gpxpy directly.

sikmir commented 1 year ago

I have the same problem. --verbose says nothing more. Parsing with gpxpy is OK.

sikmir commented 1 year ago

Looks like it's caused by: https://github.com/flopp/GpxTrackPoster/blob/e872069af0a713a479608a4a5a7987570e3bc206/gpxtrackposter/timezone_adjuster.py#L26

sikmir commented 1 year ago

Here is the fix:

diff --git i/gpxtrackposter/timezone_adjuster.py w/gpxtrackposter/timezone_adjuster.py
index 9dde750..f49e4c6 100644
--- i/gpxtrackposter/timezone_adjuster.py
+++ w/gpxtrackposter/timezone_adjuster.py
@@ -14,9 +14,9 @@ import timezonefinder  # type: ignore
 class TimezoneAdjuster:
     _timezonefinder: typing.Optional[timezonefinder.TimezoneFinder] = None

-    def __init__(self) -> None:
-        if not TimezoneAdjuster._timezonefinder:
-            TimezoneAdjuster._timezonefinder = timezonefinder.TimezoneFinder()
+    def __new__(cls) -> None:
+        if not cls._timezonefinder:
+            cls._timezonefinder = timezonefinder.TimezoneFinder()

     @classmethod
     def adjust(cls, time: datetime.datetime, latlng: s2sphere.LatLng) -> datetime.datetime:
jhavens12 commented 1 year ago

I'm having this issue as well, was this supposed to be fixed?

qdsang commented 1 year ago

gpx file add timezone

  <trkpt lat="" lon="">
    <time>2023-06-01T18:46:28+0800</time>
  </trkpt>