Open edigiacomo opened 2 years ago
Looks like your web browser can't load the javascript files. These should be in the same directory as the generated HTML files. Look for the directories jquery and openlayers and make sure your web server can access them. You can use the debugger in your browser (press F12) to debug the issue.
Thank you for the suggestion!
After some debug, I found out that TrackView.has_geo_data
is false and then openlayers in not included in the HTML file (https://github.com/scrapper/postrunner/blob/master/lib/postrunner/TrackView.rb#L34=). My FIT files have geographical data, so I suspect that fit4ruby
is not compatible with the FIT files generated by my Forerunner 25 watch: I have tested them with another tool and they contains the coordinates of my activity.
I'll further investigate my issue and eventually I'll open a new issue/PR in fit4ruby
repository, thank you for your help and for postrunner!
If I understand correctly, Activity.aggregate
should be called in order to include the map in the HTML page: Activity.aggregate
invokes Session.aggregate
which calculates the extent of the activity and sets its attributes @swc_lat, @swc_long, @nec_lat, @nec_long
. Session.has_geo_data
is true if these attributes are non-null (https://github.com/scrapper/fit4ruby/blob/master/lib/fit4ruby/Session.rb#L73-L75=) and Session.has_geo_data
must be true in order to include openlayers in the HTML.
This patch fixes my issue:
diff --git a/lib/postrunner/FFS_Device.rb b/lib/postrunner/FFS_Device.rb
index d1d0e7f..75fa5a9 100644
--- a/lib/postrunner/FFS_Device.rb
+++ b/lib/postrunner/FFS_Device.rb
@@ -53,6 +53,7 @@ module PostRunner
# FitFileStore or nil if file could not be added.
def add_fit_file(fit_file_name, fit_entity, overwrite)
if fit_entity.is_a?(Fit4Ruby::Activity)
+ fit_entity.aggregate
entity = activity_by_file_name(File.basename(fit_file_name))
entities = @activities
type = 'activity'
Thank you!
@edigiacomo - Thanks very much for your patch! It worked great for me.
First of all, thank you for postrunner!
Unfortunately, I can't see the map in the browser. Am I doing something wrong?
Thanks!