Read and Write Locations.fit

Hi everyone !

I have a question about the locations.fit file

Can I read and write this file with the SDK ?

I need to add the POIs contained in GPX files.

I know how to get the wpt list from a gpx files, and now I wan't to write this list of wpt in the locations.fit file ?

Where I can find some help about the structure of the locations.fit 

May be there is an other solution ? 

Thank you for your help.

  • Thanks ! 

    But I really want to read/write the locations.fit file.

    Do you know if (and how) I can contact the Garmin développer's Team to ask some informations about this file ?

  • Given that it's not already in the SDK, it would seem that Garmin doesn't want it there. It's kind of a mystery why it was never included.

  • Hi MisterZou,

    of cource it's possible to write Locations.fit file with the help of FIT SDK.

    Such a file must contains following parts:
    1.)
    'File ID' message (File.Waypoints = 8) with
    - Manufacturer (Manufacturer.Garmin = 1),
    - Product ('Edge 1000' = 1836) and
    - Serial Number of Edge

    2.)
    FileCreatorMesg (Message number 'FileCreator' = 49) with
    - Software version of Edge

    3.) => very important !!!
    WayPointSettingsMesg (Message number 'WayPointSettings' = 189) with
    - WayPointSetting (byte)
    = 0 wayPoints will be added to existing wayPoints
    = 1 wayPoints will replace existing wayPoints
    = 2 all existing wayPoints will be deleted (empty locations.fit)

    4.)
    List of WaypointMessages ( Message number = 29 ), containing
    - a name (max. 15 characters)
    - a description (max. 47 characters)
    - a altitude (optional)
    - a timestamp (optional)
    - Latitude,
    - Longitude
    - a symbol (optional)

    All information can you find, if you 'inspect' a Locations.fit, created by BaseCamp :-)

    Hope this helps.

  • Useful info, thankyou.
    EDIT COMMENT - I worked out answers to some of my questions, so have updated this post accordingly.

    Followup question about a block within the Locations.fit file, the "List of WaypointMessages" block, message number 29, as per SONGOKUONBIKE's post above.

    I used the Python SDK to read a Locations.fit file from my Garmin Edge 810 to display the data..

    Below is an example of one of the blocks within message number = 29 which I have labelled with the meaning of each data item. This lines up with paragraph 4.) from SONGOKUONBIKE's post above.

    • Info on data item 3: Code number for the Waypoint symbol on the map. Some values mentioned below?
      Is there a place to look for a reference table - eg built-in set of Waypoint symbols for standard Garmin Edge 810?
    • Info on data item 4:  this is the Altitude/Elevation, but a coded value:
      Elevation in Meters = (ValueInFITFile - 2500) divided by 5

    Thankyou.

    {
        0: Scheltema,  TITLE 

        1: 622330880,  LAT (divide by 11930465 to get degrees)
        2: 53553920,   LONG (divide by 11930465 to get degrees)
        3: 94,         CODE NUMBER OF WAYPOINT SYMBOL, 94 is BlueFlag, 96 is RedFlag
                                            57 is Civil-Residence used for "HOME" from what I can see
                       Working on deriving the full list 

        4: 2499,       ELEVATION. To get the Elevation in meters value
                       as seen in device, subtract 2500 and divide by 5
                       So 2500 (or 2499) indicates Zero. 2000 is -100m. 2550 is +10m
                       3500 is +200m

        6: Description Optional field containing item Description if present
      253: 1045394302, TIME AND DATE STAMP (seconds since  UTC 00:00 Dec 31 1989)
      254: 4           SEQUENCE NUMBER OF THAT ITEM IN THE FILE
    }

  • Ignore this, I will create a new thread

    From what I can see the existing Python module does not contain the functionality for writing a FIT file?
    Useful to have a Python routine to read a FIT file, make some changes, and save it again. There are modules for other languages (eg C++). https://developer.garmin.com/fit/example-projects/cpp/

    Any plans to extend the Python library?

  • Hi Daksol,

    I'm using C# SDK to read and write .fit files for my Germin Edge 1000.

    Here ist the field definition for a waypoint message:

    public sealed class FieldDefNum
    {
    public const byte MessageIndex = 254;
    public const byte Name = 0;
    public const byte PositionLat = 1;
    public const byte PositionLong = 2;
    public const byte WayPointDetails = 6;
    public const byte Timestamp = 253;
    public const byte WayPointSymbol = 3;
    public const byte Altitude = 4;
    public const byte Invalid = Fit.FieldNumInvalid;
    }

    And you are right. Byte 3 represents the waypoint symbol and byte 4 is used for altitude. Your value 2499 looks a little bit strange. May be, you read it as an interger value, but Garmin stores altitude values as float values.

    ///<summary>
    /// Retrieves the Altitude field
    /// Units: m
    /// Comment: Altitude at the described WayPoint</summary>
    /// <returns>Returns nullable float representing the Altitude field</returns>
    public float? GetAltitude()
    {
    Object val = GetFieldValue(4, 0, Fit.SubfieldIndexMainField);
    if (val == null)
    {
    return null;
    }

    return (Convert.ToSingle(val));

    }

    How to get a list of possible values for symbols? 

    Try to edit the symbol of an existing position inside your Edge 810 and you get a list of possible values:

    Change the symbol and read locations.fit  again :-)

    Hope this helps alittle bit.

  • FITfileR is an R package to read FIT files produced by fitness tracking devices like Garmin Edge cycle computers or sports watches. The intention for FITfileR is to use native R code to read the files directly, with no reliance on the FIT SDK or other FIT parsing tools. As such it should be platform independent, and not require any additional software outside of a working version of R. Additionaly, I suggest you to read https://sloboda-studio.com/ruby-on-rails/ it's useful blog where you can find helpful info.