marcusvolz / strava_py

Create artistic visualisations with your exercise data (Python version)
MIT License
150 stars 18 forks source link

Getting: "gpxpy.gpx.GPXException: latitude is mandatory in None (got None)" #23

Closed dhruv-jadhav closed 1 year ago

dhruv-jadhav commented 1 year ago

Hey,

I tried using the CLI tool but I'm getting this error: gpxpy.gpx.GPXException: latitude is mandatory in None (got None)

I tried setting --lon_max, --lat_max to 180,90 and --lat_min, --lon_min to 0,0 but still getting the same error.

Is this a problem with a specific .gpx file? And if so how can I find that one because the error doesn't show which file.

Thanks

hugovk commented 1 year ago

Yes, I've seen this and it's a problem with a specific .gpx file.

I think we should fix this to print the name of the problematic file, skip it and continue.

In the meantime, you can temporarily add this to stravavis/process_data.py (its location should be printed in your full traceback):

 def process_gpx(gpxfile):
+    print(gpxfile)
     with open(gpxfile, encoding="utf-8") as f:
         activity = gpxpy.parse(f) 

The either delete the gpx file, or in my case I opened it in a text editor, and found and deleted the problematic <trkpt> (it was the first one):

      <trkpt>
        <ele>31.2</ele>
        <time>2019-08-31T09:02:36Z</time>
        <extensions>
          <gpxdata:temp>0</gpxdata:temp>
        </extensions>
      </trkpt>

The rest all have lon and lat values, like this:

      <trkpt lon="24.12345" lat="60.12345">
        <ele>31.2</ele>
        <time>2019-08-31T09:02:37Z</time>
        <extensions>
          <gpxdata:temp>29</gpxdata:temp>
        </extensions>
hugovk commented 1 year ago

Please see PR https://github.com/marcusvolz/strava_py/pull/27 to fix this.

dhruv-jadhav commented 1 year ago

Great, the fix works perfectly!

hugovk commented 1 year ago

Good to hear! I'll merge that and put out a new release so people can do their year-end visualisations!

I'm curious, do you know what the problem with your GPX file is? Is it the same thing as I had above?

Mine was one that had been combined using the GOTOES utilities.

dhruv-jadhav commented 1 year ago

Yep, I had problems with the files which were merged using GOTOES. image

marcusvolz commented 1 year ago

Many thanks @hugovk for this and all the recent updates!

dhruv-jadhav commented 1 year ago

Yes, thanks a lot @hugovk! Strava's Year In Sport was behind a paywall this year so this package helped me get a certain level of satisfaction. Great work!