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

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

Closed
dhruv-jadhav opened this issue Dec 29, 2022 · 7 comments · Fixed by #27
Closed

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

dhruv-jadhav opened this issue Dec 29, 2022 · 7 comments · Fixed by #27

Comments

@dhruv-jadhav
Copy link

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
Copy link
Collaborator

hugovk commented Dec 29, 2022

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
Copy link
Collaborator

hugovk commented Dec 29, 2022

Please see PR #27 to fix this.

@dhruv-jadhav
Copy link
Author

Great, the fix works perfectly!

@hugovk
Copy link
Collaborator

hugovk commented Dec 30, 2022

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.

hugovk added a commit that referenced this issue Dec 30, 2022
@dhruv-jadhav
Copy link
Author

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

@marcusvolz
Copy link
Owner

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

@dhruv-jadhav
Copy link
Author

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!

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 a pull request may close this issue.

3 participants