erik / derive

Generate personal heatmap from GPX/TCX/FIT/IGC data
https://erik.github.io/derive
MIT License
498 stars 63 forks source link

Feature request: color activities lines by activity type #71

Open roboes opened 1 year ago

roboes commented 1 year ago

Hi Erik,

First of all, thanks creating and maintaining this amazing tool.

One feature that I miss is the possibility to change and choose the color by activity type (e.g. ride, run, hike).

It should be possible to retrieve the activity type from .tcx files (e.g. <Activity Sport="Biking">) and .gpx files (e.g. <type>cycling</type>).

Thanks!

erik commented 1 year ago

Thanks @roboes! This would be a nice change to have, and I don't think it would be too complicated.

Right now, there's very simple activity type detection based on the filename (implementation).

We could support detection from the files directly by modifying the extractTracks functions. So for example, instead of parsedTracks.push({timestamp, points, name});, it'd be parsedTracks.push({timestamp, points, name, activityType});

Would be happy to include this if you'd like to take a crack at it, otherwise it may be a while before I have time to do this myself.

roboes commented 1 year ago

Thanks for the prompt answer, @erik!

Right now, there's very simple activity type detection based on the filename (implementation).

I wasn't aware of this feature, thanks! It would be nice to additionally have the option to choose the desired color for each activity type in the GUI.


Would be happy to include this if you'd like to take a crack at it, otherwise it may be a while before I have time to do this myself.

Given that the simple activity type detection satisfies my current needs, take your time for implementing it.

Thanks!

mattpopovich commented 1 year ago

@roboes, for whatever it's worth, I just quickly threw together some python that will separate your Strava activities by activity type. You can then drag the exported activity type's folder contents into @erik's derive to see heatmaps for ex. only running, only biking, etc.

It won't color code things for you, but may be helpful with getting some sort of separation between activity types.

Cheers! And thanks @erik for this awesome tool!

roboes commented 1 year ago

@roboes, for whatever it's worth, I just quickly threw together some python that will separate your Strava activities by activity type. You can then drag the exported activity type's folder contents into @erik's derive to see heatmaps for ex. only running, only biking, etc.

It won't color code things for you, but may be helpful with getting some sort of separation between activity types.

Cheers! And thanks @erik for this awesome tool!

Thanks for sharing, @mattpopovich! This is a neat solution.

In the end, my approach was as follows: I first filtered "Ride" activities in a dataset containing activities ids and activities types; than, I ran my own function to batch export activities to .gpx files (given a list of activity ids). Last, I added the "-Ride" argument to the file names and repeated the same process for "Run" activities, being able to accomplish the desired solution.