This object is in archive! 

Locus activity export to FIT format

Mick FU shared this problem 2 years ago
Solved

Hello,

I am new on this forum, but I use Locus highly : mapping, orienting, navigating, analyzing activities, modifying activites, etc…...


Sometimes I need to modify activities imported from plateforms, which Locus do perfectly (import fit file and then modifying), but when I export them again into fit format, files seems not properly/completely formatted (at least mine), not following the official sdk requirements, and thus not handled properly by some other tools : at least it is my own analysis.

I definitely decide to join this forum, to see if I can get some assistance and/or changes with fit files export function from Locus (for activities). I searched for other issues like this, but it seems not totally the same.


In summary, some mandatory messages are missing for exported activity file (SESSION, ACTIVITY) and some messages defined “correctly” but are missing some data.

I also try the add-lon locus-out-fit, but result is not good also, so I preferred to analyze direct locus fit export.

Is it possible, and for sure I can provide as many example or tests, to update Locus activity fit file export so that it follows the fit SDK which some 3rd party tools are following religiously ?


Thanks a lot in advance.


Here are some details and explanations, regarding one activity file generated by Locus : not changed at all : locus_fit_SnowShoeing_2021-12-30T12_15_35.fit

If I convert this fit file into CSV (attached also), here are my findings :

  1. There is a LAP message :
  2. In LAP definition there are correctly the mandatory timestamp and start_time : Definition,0,lap,timestamp,1,,start_time,1,,start_position_lat,1,,
  3. But missing timestamps and start_time data in LAP message : Data,0,lap,start_position_lat,"510378757",
  4. In the same LAP message :
  5. There is a total_descent definition : total_elapsed_time,1,,total_ascent,1,,total_descent,1,,max_altitude,1,,
  6. But no total_descent data in the message : total_ascent,"389",m,max_altitude,"1749.0",m,
  7. There is an EVENT message :
  8. With timestamp in the definition : Definition,0,event,event,1,,event_type,1,,event_group,1,,timestamp,1,,
  9. But no timestamp data in the message: Data,0,event,event,"0",,event_type,"9",,event_group,"0",,,
  10. According to FIT SDK requirements (https://developer.garmin.com/fit/file-types/activity/) , an activity file (type 4) must contain mandatorily an Activity Message AND an SESSION message
  11. And there are none in the Locus fit file ☹

If I tweak manually the csv file to add missing informations (LAP/EVENT ones + ACTIVITY + SESSION), the fit file becomes “OK” for uploading into other parties that are really strict regarding fit content. I also attached OK tweaked csv and fit files.

Replies (12)

photo
3

Hi Mick,

thank you for the very precise test & suggestion.

Indeed, I may confirm your observations, so I made a few changes that may cover mentioned problems. Give a try to the next app version (will be published most probably till the end of January) and let me know. Thanks.

photo
1

Wow, so quick. Thanks a lot.

Eventually, before I could test on my own, would it be possible to share some fit files for you to import, export again and share them back to me? I would be able to check if they are digested by 3rd party platform (Suunto API FYI).

Thanks again.

photo
2

Hi Mick,

best you may do if you want to spend some more time on this and verify that problem is really fixed, is to use fresh Beta version. More about it here: https://forum.locusmap.eu/index.php?topic=7632.msg66753#msg66753 . Link to Beta versions is visible in my signature on the forum.

photo
1

Hi Menion,

Fresh beta works...............99% : Locus activity fit export file is well properly imported by Suunto : so many thanks.

Last 1% might be debatable :(

It is about Total_Elapsed_time vs Total_timer_time.

Values in fit file seems to be correletated to Locus data : Total_elapsed_time = Track time (3h41m28s) and Total_timer_time=Track time (movement)(1h28m01s) for my example.

No pauses, just slow movement, and at the end, activity duration taken into account by Suunto (but also by Runalyze with manual fit import) is finally the result of Locus Movement time (not the real duration of activity).

In theory (at least my own understanding of the fit sdk), total_elapsed_time is including pauses, and total_timer_time is excluding official pauses , and it seems to exist a specific message for total_moving_time.

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


What do you think, please ? Does it make sense and could be changed from Locus export side ?

Again, so many thanks for first successfull change.

photo
1

Hello,

In addition to my last question/request about total times, I would dare to ask if it could be conceivable to request to add to Locus export options, the "export to Suunto" ? Like the export to Runalyze :)

Not anything urgent or mandatory, if/when fit files will become perfect it is still manageable through other services, but from Locus, would be so perfect.

Thanks.

photo
1

Hi Menion,

sorry to insist :)

Do you think you can change Locus fit export : Total_timer_time value to its "real" meaning = total time of activity in terms of timer, and not moving time ?

Thanks.

As you tagged this problem message as "solved", i am not sure wether you read it again :( :)

photo
2

Hello Mick,

we are reading all comments also for topics that are already marked as "closed".

I'm looking at what you wrote and you are of course correct. The app is not perfectly ready for this kind of value, but I'll try to improve it. Give a try to the next Beta version please (will be published till the end of the week), thanks.

photo
1

Hi Menion

Thanks a lot, i will test further with next beta. And sorry to have imagined one didn't read all comments :( I am working with some teams and job is managed by tickets. Once ticket is said as solved......... ;) But it is another part of the world and business. Thanks for all your job with Locus.

photo
1

No problem, every company = different ).

Menion

photo
1

Trying current beta 4.5.7.4_1058 again with another activity, I found another point related to time, but at fit import process.

Attached an original fit file from my watch device. It is importing well in Locus, but :

in Locus , the activity duration is different from original

Locus After import : 2:26:31 = 8791s

Original activity : 1:58:19 = 7099s = Total_timer_time from original file

Total_elapsed_time is longer : 8814s (due to a pause (timer stop) during 1715s)


it seems Locus is not taking into account the pause, but even not really taking into account fit value (8791 is not 8814).

After analysis, i may understand that locus takes first and last records with GPS values, and track time is calculated from timestamps difference, but without pause.


Would it be possible that locus takes fit total_timer_time as activity track duration ?

Would it be possible that locus takes into account the pauses in activities at import ?


Deeper analysis :

First track point in Locus, created on Jan 23, 2022, 11:33:52 = timestamp 1011868432 = first point with GPS data in fit file

Last track point in Locus, created on Jan 23, 2022, 14:00:23 = timestamp 1011877223 = last point with GPS data in fit file

1011877223-1011868432 = Duration = Track time in Locus = 2:26:31 = 8791s

photo
1

Thanks for the observation. Generally, Locus Map does not keep any hardcoded values, everything is computed on the fly. So there is no option to "locus takes fit total_timer_time as activity track duration". Anyway, pause should definitely be considered. May you please share with me any FIT file with this pause so I may test it also on any file not directly exported by the Locus Map? Thanks.

photo
1

oh, sorry, i forgot to attach the file :(

here it is and thanks.

photo
1

Hi Mick,

as I see, support for pauses is missing in the import, but also in the export where app simply always export only a one "lap" message. As I see, it is a lot more work than simple bug fix and my tasks-queue is currently quite full. I've added this as another task to my queue on later. I'll keep you informed here once this will be done, but please do not expect it too early, we really currently have a little different priorities. Thanks for understanding.

photo
1

Hi Menion, i understand, no worries (and even i could say i was "guessing" this ;) )

i will not expect it to arrive soon, but i know it will arrive, and i will wait eagerly :)

fit files are nice, but can contain so many different informations, and maybe not all usefull for all parties. I understand Locus (you) have to be sure to manage things completely/fully (import/export, with "just" mandatory data).

Thanks in advance.

photo
1

Hi Menion,

Hope you are fine.

Any news on this please ?

Thanks.

photo
1

Hi Mick,

as I wrote before, this really does not have a priority now, sorry. I have this task in my todo list together with bunch of cca 200+ items. Thanks for understanding.

photo
1

Hi Menion,

Just a kind ( and full of respect for the whole job done) reminder about this topic.

Lack of pause management in Locus for fit files, makes this almost useless 😔 to work with this file format.

photo
1

Hello Mick,

give a try to the latest version from the Google Play. I made just a small change where app exports multiple "laps" based on breaks. Hope this is what you needed.

Jiří M. aka Menion

photo
1

Hi Menion,

First for all, thanks.

Second, i tried this new 4.10 version (this one, right ?), and i am confused : i did a very small test, walking and recording for few seconds, pausing (not stopping), resuming, a couple of times, and save this test. I export this activity to fit file, and ......, only one lap message in the result.

I am even not sure how to see breaks in Locus ? Any link to wiki ?


and i tried to import a fit file with pauses, it is still doesn't show any changes, i guess it is expected to behave like this currently, right ?

photo
2

Hello Mick,

this was result of very quick "fix" right before the release and here it is > bugged functionality, sorry.

Will be improved in the next app version for export and also import.

Jiří M. aka Menion

photo
1

Rodger. Thanks for all.

And if import is also considered it is even closer to be perfect 👌 👏

photo
1

Hello Menion,

How is going this topic ? is there any beta i could test ? I would be happy to do so.

thanks.

photo
1

Hello Mick,

it has been almost two months since previous published version. And finally today we will be publishing a new version so give it a try please. I remember I did some changes regards this issue so I hope it will be fixed, finally. Thanks for the patience.

photo
1

Hi Menion

Thanks, i tried the latest beta RC, and i see now some changes.


I think lap management could be good (not tested deeper), but pause management seems not good :(

to me, pause is not a matter of lap, but a matter of times differences (elapsed and total) AND events (stop/start timer = break)


I did the following test :

- I record the same test activity, both in Locus and with my GPS watch (trying to push buttons at the same time)

- Start recording + move around 42 seconds + pause (around 34 seconds) + unpause + move around few more seconds (26s)+ stop recording and save

--> total including pause = 102, total exluding pause = 68, pause = 34


Then I :

- import my watch activity fit file ("watchfit") into locus and then export it again from Locus into another fit file ("watchlocusfit")

- export locus native activity into fit file ("Locusfit")


Results : i use fit file viewer to compare quickly


Locus activity in Locus

TrackTime = 1:07 = 67

TrackTime (movement) = 1:07 = 67

Can't find any info about pause (does locus can display this pause ?)

Export to Locusfit file:

Session data

total_elapsed_time(s)= 67

total_timer_time(s) = 32 --> strange, as first walk was 42 seconds --> could it be more the pause time ?

total_moving_time(s) = 67 --> strange to be moving more that timer time

Lap data

One lap with

total_timer_time(s) = 67

total_elapsed_time(s)= 67

Event data

Only two events (one start and one stop_disable_all)


Watch activity imported in Locus

TrackTime = 1:38 = 98 (= timestamp difference of first and last point with lon/lat data), why not.

TrackTime (movement) = 1:38

Can't find any info about pause

Original Watchfit file:

Session data

total_elapsed_time(s)= 102

total_timer_time(s) = 69

no total_moving_time(s)

No Lap data


Event data

4 events (2 starts and 2 stops) and timestamps duration between stop1 and start2 = 34 --> pause


Watch activity exported from Locus

Watchlocusfit file:

Session data

total_elapsed_time(s)= 98 logic but false

total_timer_time(s) = 98 no pause any more

total_moving_time(s) = 98

Lap data

One lap with

total_timer_time(s) = 98

total_elapsed_time(s)= 98

Event data

Only two events (one start and one stop_disable_all)


My conclusion, but i might be wrong :

Fit import doesn't take pause into account (pause managed with event starts/stops and not laps (laps are not pauses).

Fit export depend on wether activity is recorded in Locus (wrong calculation ?) or imported (no more pause after export).

photo
1

in addition to time comments (pause management vs laps), i discover that locus doesn't export speed values into fit files :(

speed messages are there, but with value = 0 :( :(

photo
1

Hi Mick,

you are the "victim" of the task, where developer (myself) know that there is a problem, but nobody except the single user (you) is interested in fix. Sorry for this and thanks for the patiance.

I've found that app incorrectly computed second and following "laps". It always used also last point from previous lap so values in "lap" message was incorrect.

Btw. Locus Map does not use "laps" at all, so I cannot see difference between "lap" and "pause", sorry.

Speed values : is it correct to export speed from GPS? Because in GPX files, only speed from sensors should be included. Speed from GPS may be computed from coordinates and time difference. I've then removed invalid "0.0" values from speed column (so GPS-based speed won't be export at all) ok?

You also mentioned that Locus Map ignore lap from imported "watchfit" file. Do you still have this file for test? Thanks.

photo
1

Hi Menion,

No worries, always loves your answers :)

1- for speed values, i would say : export into fit file the values used to display the speed graph in Locus :) There is a graph, so there are values, so why not exporting them :) ? Either from GPS or Sensors, Locus knows speed.

2- about Lap/Pause topic : i can reasonnably live without real laps (which are not used in Locus as you said)

It was not the original issue i had, and the discussion seems to have deviated :)

Laps are events during the total duration which defines intervals, with their own durations (between two trigger of lap event). If not managed in Locus, why not :)

But pauses are stops in the time recording (breaks) (triggered by timer stop events and then start again), and then the total duration splits is well explained here https://developer.garmin.com/fit/cookbook/durations/

total_timer_time (track time in locus) = total_elapsed_time - pauses (breaks)

Pauses duration is sum of duration between each single timer stop and the next timer start.

Moving time is another layer (track time (movement) in Locus), not important for me, but is a calculated duration and could be exported in total_moving_time, if needed.

And finally, not sure to retreive where i would have mentionned the Locus ignore lap from watchfit file (which i didn't have anymore, sorry).

photo
1

Hello Mick,

1) this should be now correctly working in the new 4.11.1 version.

2) understand, thanks. Because Locus Map is made mainly for hike & bike and not directly to measure some sports activities, there exists only a system of pauses, not laps. Currently, export to FIT file, split track based on pause intervals, and use them as "laps" for export. This probably causes a small mess in export files.

So the solution I see is not to use "Laps" for export at all. Instead, any field that matches recording pauses better. For example "Session" message is defined here https://developer.garmin.com/fit/file-types/activity/ ?

photo
1

hello Menion,

1- thanks, 4.11.1 version is exporting speed in fit file : cool :)

2- agree : laps are laps and not meant to try export anything else than laps :)

in your link for fit sdk, i would not use Session summary to manage pauses : session is more to indicate a new "sport type" (example : in one activity, multiple sessions with Hike/Bike/Hike/Bike).

Pauses/Breaks could/should be managed through events message : "Events can indicate when the timer was started or stopped"

example of multiple pauses :

Data,4,event,event,"0",,timestamp,"1029152858",s,event_type,"1",,timer_trigger,"0"

Data,4,event,event,"0",,timestamp,"1029156193",s,event_type,"0",,timer_trigger,"0"

Data,4,event,event,"0",,timestamp,"1029159192",s,event_type,"1",,timer_trigger,"0"

Data,4,event,event,"0",,timestamp,"1029160101",s,event_type,"0",,timer_trigger,"0"

Data,4,event,event,"0",,timestamp,"1029168308",s,event_type,"1",,timer_trigger,"0"

Data,4,event,event,"0",,timestamp,"1029170515",s,event_type,"0",,timer_trigger,"0


but not only events are "needed" : events are used to know when pauses happened, but duration of activity need to be calculated differently :

total_timer_time (track time in locus) = total_elapsed_time - pauses (breaks)(sum of all pause times).


in the previous example : all pauses represent : (1029170515-1029168308)+(1029160101-1029159192)+(1029156193-1029152858) = 6451 seconds.


Which results in the following session message : Data,6,session,timestamp,"1029171440",s,start_time,"1029147367",,event,"8",,event_type,"1",,sport,"17",,sub_sport,"3",,total_timer_time,"17620.721",s,total_elapsed_time,"24072.771",s,

24072 = 17620 + 6451 (almost :) if we don't count rounding somewhere)


To me, Locus should be able to retrieve the pauses/breaks for an activity (hike or bike or...), export each break start and stops in event messages, and export total_elapsed_time / total_timer_time with proper calculated values.

photo
2

Thanks Mick, appreciate it.

so the optimal solution >

- one sessions message

- then one lap message with identical values

- list of `RecordMesg` split by EventType START & STOP to inform about breaks

So next Beta for test at the end of week if you will be interested. If something won't work as expected, some sample data should be really welcome! Thanks.

photo
1

Hi Menion

exactly this (i hope :) ), plus, proper calculation of total times ;)

photo
2

Yup, done. Hope this will works as expected :)

97bf21918d985142ef11e61b7588a65a

photo
1

Hi,

Waiting eagerly for new beta to test 😊. Hope it is not the 4.11. 2 already on the drive, and I am waiting for nothing ? 🤔

photo
1

Hi, version was not yet published. I'm stuck on one problem with images .. so later this week.

You may also watch this topic where I'll write in the moment, new version will be out.

photo
1

4.11.1.3 bêta tested, and...... Much better 😊

I record à small activity in Locus, with one pause.

Good points :

  1. fit export creates well a file with timer stop/start events. Which gives well pauses information. Thanks.
  2. Total_elapsed_timein in the exported file is well equal to the total duration.

Not so good points :

  1. No total_timer_time exported, which is important, but total_moving_time, yes.
  2. If i reimport this fit file into Locus, i think Locus is loosing pauses 😕. The duration in Locus is including the pause, and if reexported again, no more timer events.

Fit import should also be able to manage pauses/breaks, and proper duration calculation. Next step 😁

photo
1

Hello Mick,

thanks for the tests. Yes, import is currently untouched, so these new changes, mainly handling of breaks, is not done yet. I'll look at it ...

Anyway problem no. 1 > "total_timer_time" is weird. May you please double check it? Because all three times are set in the code for the "SessionMsg" and also for every "LapMsg" as I see.

photo
1

Hi Menion,

Thanks in advance for next step looking at it for import :)

And it enables me to discover something in locus i never looked at : pauses/breaks are more called "gap", right ? when editing a track, one can insert a gap (which seem to represent "exactly" (?) what a pause is)


for total_timer_time, please find attached my test files :

  1. one activity recorded by locus 4.11.1.3 and just exported to fit
  2. the same fit file, reimported, and just reexported.

Results:

  1. total_timer_time is well in definition messages, but not in data ones
  2. total_timer_time is well everywhere, but : value is for sure not correct (pause not managed at import), but more strange : value = 0.112s instead of 112s

can't find any pattern, maybe reimport of same one is not good test, while total_timer_time is not existing.

good luck :) and thanks for all.

photo
1

Problem with "total_timer_time" ah damn, I've divided time by 1000 value two times. Thanks, good observation!

So hope that the next version will be (almost?) perfect!

photo
1

OK, when it is there, but for other example, there is no total_timer_time in messages (neither session nor lap 😉)

photo
1

If I could also dare a comment for when you will work on "pauses" Import from fit 😊.

As far as I understand, Locus is focus on points timestamps) with GPS coordinates. While fit files contains also potentially data with timestamp not mandatorily with such coordinate (recording devices may optimize recording in case of no movement).

Then pause (timer trigger) might happen in these cases, thus after (some) time after latest timestamps with location.

Maybe not easy, but could be lot more precise is Locus is able to keep timestamp of events, to keep perfect pause information (start, stop : = duration), meaning probably to create extra GPS points to support thus break / gap 😉.

photo
1

4.11.1.5 beta installed, and looks promising 😊. Not too much time to test deeper, but I will.

Just a first bug : export button doesn't work. Need to share instead.

First thanks, next ones after further tests 👍👍

photo
1

Hi Mick,

thanks for the test! "Export button" does not work? May you please explain it a little more? I see no problem.

photo
1

Ah sorry, I now read the discussion on the forum ... will look at it, thanks.

photo
1

Hi Menion,

After deeper investigation : i think it works exactely ................ as i thought :)

1- Fit export is working properly in terms of pauses management, duration calculations, etc.... : GREAT, and thanks again

2- Fit import is really good, but not perfect, and i will try to explain :

As i expected (not any criticizm ;) ), Locus is creating pause/gap/breaks, according to timer trigger from fit file, but often (always ? ), there is no GPS position at the exact timestamps of pause event. And, "nicely", locus is taking the nearest GPS point to create the pause/gap/break after import, thus in the locus track database. But it creates offsets in the real start/stop .

in the file attached, i compared original fit file, with the same activity, imported and re-exported.

on the left, i focused on pause events and just before and after GPS point of original fit

on the right, i focused on pause events only for locus exported fit

Result : orginal activity is 5:26:19 while Locus one is "only" 5:25:24 (couple of seconds, lost for each pause/break offset in time, due to non GPS data).


not sure how to manage it, if i were to code this (even if i have no coding skills :) ).

in terms of logic, according to what i understand from what i see of current behaviour : i would say :

Locus would detect orginal event pause timestamps (as of now), then, search just before or after GPS point location (as of now), but then, create a new GPS point, with same coordinate, but with pause timestamp.

Logic ? I think

Easy ? Not sure :)

by the way, a really great improvement :) thanks.

2b476413189ffe79b840b0b8c1876c45

photo
1

Hello Mick,

hmm, thanks for the very precise test! I think, we are done here ...

Locus simply keep index of point, where break happend. And because there can't exists two points with identical coordinates, there is no simply solution for this. I think this is really minor issue and because Locus Map does not try to be an exact sports-manager and because FIT is not even a most used data format, excuse my lazyness in solving this issue. Thanks for understanding and once again for the patience with me!

Jiří M. aka Menion

photo
1

Hi Menion,

I understand your "lazyness" :), even if i am little disapointed against all this work to be stopped just near almost perfection.

One other workaround i could imagine :) (and after i will stop :) )


Since Locus can now detect pause/breaks events in fit file during import,

Since i understand that locus is finding the nearest GPS points according to these breaks events and tag them as a break (keeping their original timestamps)

WHY NOT, during the routing of "tagging", changing these GPS points timestamps, by the break/pause event timestamp ? I think it would solve the issue ,no ? GPS coordinate will still be unique and breaks will be accurately represented.


In the below (and same example as before) :

initial time trigger is 1031213169, but first GPS point is 1031213172

Can Locus import this first point with 1031213169 time instead ?

For first real break : why not writing the GPS point originally at 101223341 with the real break time = 1031223351 ?

and so on.....

fb0b1ee208c776a1cd36351975fa0b94



Replies have been locked on this page!