add distance to the course points in garmin fit tile

Hi there,

I will start with description of the problem I have.

When I import GPX file with course points to the Garmin Connect it shows the course points on Garmin Connect map but then during the navigation the watch does not show distance to the next course point nor it alerts user when the course point is approaching.

When I create the course points on Garmin Connect map manually everything works fine.

The difference is that when imported from GPX Garmin Connect does not calculate and add distance to each course point. That can be seen in the JSON that the browser is downloading in network tab of the chrome dev tools when displaying the route in Garmin Connect.

I have tried to report this as bug to Garmin but I got replied that Garmin Connect does not support import of GPX file with course points.

So what I need to do is to use Fit SDK to decode the FIT file, add distance to each course point and then encode the data back to the FIT file format.

Is that possible? Can somebody give me some guidlines how to do it with C#  SDK? (I would use Javascript SDK but it looks like it is not possible there.)

Thanks a lot.

  • The Cookbook recipes are all in C#. There is a recipe for encoding FIT Course files. The recipe on decoding FIT Activity files can be applied to decoding FIT Course files. All files types are decoded the same way. 

    https://developer.garmin.com/fit/cookbook/ 

  • For this very specific purpose, I've created my own Python implementation which converts GPX to FIT while maintaining waypoints *and* course points (the latter being important as those show up in 'up ahead'). I simply loop through every waypoint and add the distance between those until I hit a coursepoint and use the calculated distance for the coursepoints distance.

  • That would save the step with garmin connect converting the gpx to the fit. And it would save my time going through the SDK and implement another version.
    Can you please share the code? I am not that proficient with python but I think I would be able to run it.

    Best solution would be to make garmin to fix that bug because I think it would be very easy fix. But it is very hard to reach there somebody competent that even comprehends what is the problem.

  • I've made https://github.com/wschoot/gpx-to-fit public but mainly see this as inspiration as it may be a bit rough around the edges. The usecase for myself mainly is to have a GPX with some waypoints I want to visit in optimal order using Up Ahead on my Garmin watch. I then load the GPX with the waypoints into Garmin Basecamp which allows me to create a track (not a route) using "Optimize" to calculate the best route. the gpx-to-fit.py script combines this into something my Fenix 7 understands.

  • Thanks a lot! It works really well for me.
    I needed to change the encoding and comment out inserting of the turn directions points but other than that it needed no changes.
    Now I can make fit file from gpx with waypoints and copy the file to the garmin watch which will then show the name and distance to the next point.