All Projects → FelixVanOost → Strava-Analysis-Tool

FelixVanOost / Strava-Analysis-Tool

Licence: GPL-3.0 License
A Python tool to analyze and display Strava activity data.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Strava-Analysis-Tool

Strava-local-heatmap
Python script to generate a high resolution heatmap from Strava GPX files
Stars: ✭ 102 (+218.75%)
Mutual labels:  strava, heatmap, cycling
cycling
🚴 My cycling trip from ShangHai to Wuhan in China.
Stars: ✭ 34 (+6.25%)
Mutual labels:  strava, cycling
StravaHeatmap
Make a simple heatmap from your strava data
Stars: ✭ 23 (-28.12%)
Mutual labels:  strava, heatmap
xyz-qgis-plugin
Plugin for QGIS to connect to the HERE XYZ Hub API
Stars: ✭ 22 (-31.25%)
Mutual labels:  here-maps, here-xyz
strava
PHP Class for the Strava API (v3)
Stars: ✭ 117 (+265.63%)
Mutual labels:  strava, cycling
nhl-twitter-bot
🚨 Hockey Game Bot is a Python application that sends important NHL events to social media platforms in (near) real time.
Stars: ✭ 18 (-43.75%)
Mutual labels:  sports
cfbscrapR
A scraping and aggregating package using the CollegeFootballData API
Stars: ✭ 25 (-21.87%)
Mutual labels:  sports
arkit-depth-renderer
Displays the depth values received by the front-facing camera.
Stars: ✭ 48 (+50%)
Mutual labels:  heatmap
catheat
Plot categorical heatmaps with seaborn
Stars: ✭ 17 (-46.87%)
Mutual labels:  heatmap
COVID-CXNet
COVID-CXNet: Diagnosing COVID-19 in Frontal Chest X-ray Images using Deep Learning. Preprint available on arXiv: https://arxiv.org/abs/2006.13807
Stars: ✭ 48 (+50%)
Mutual labels:  heatmap
COA
Openstack Foundation Openstack Certified Administrator exam Preparation
Stars: ✭ 41 (+28.13%)
Mutual labels:  heatmap
there-are-lots-of-people-in-Baiyun-airport
挑战杯 - 广州白云机场人流量时空分布预测系统 - 前端
Stars: ✭ 14 (-56.25%)
Mutual labels:  heatmap
PhyloProfile
A phylogenetic profile analysis tool
Stars: ✭ 24 (-25%)
Mutual labels:  heatmap
IPL-ML-2018
Predicting IPL match results. https://kuharan.github.io/IPL-ML-2018/
Stars: ✭ 14 (-56.25%)
Mutual labels:  sports
retrosheet
Project to parse retrosheet baseball data in python
Stars: ✭ 19 (-40.62%)
Mutual labels:  sports
SimCycling
Use your bike and your home trainer as a controller in racing simulation games.
Stars: ✭ 28 (-12.5%)
Mutual labels:  cycling
Multi-Person-Pose-using-Body-Parts
No description or website provided.
Stars: ✭ 41 (+28.13%)
Mutual labels:  heatmap
zwift-workout-file-reference
Reference documentation for the Zwift workout file format
Stars: ✭ 54 (+68.75%)
Mutual labels:  cycling
opta sd
OPTA Sports Data Soccer API Client (OPTA SDAPI)
Stars: ✭ 28 (-12.5%)
Mutual labels:  sports
QHeatMap
Generate Heat map in Qt.
Stars: ✭ 72 (+125%)
Mutual labels:  heatmap

Strava Analysis Tool

A Python tool to analyse and display Strava activity data.

Introduction

The Strava Analysis Tool tool aims to use the data collected by Strava to offer a new insight into your activities and workouts. Its original purpose was to create a personal activity heatmap (similar to the paid Strava feature for Summit members), but now encompasses a greater variety of data analysis and visualization options.

A full list of features and known issues is covered in the notes for each release.

Installation

1. Python + Dependencies

The tool is developed with Python 3.9. Its dependencies are tracked in requirements.txt (for Pip) and environment.yml (for the Anaconda distribution).

Anaconda is recommended for Windows users as it comes pre-installed with many of the required packages. It is also the preferred method for installing GeoPandas, which is leveraged for the processing and exporting of geospatial activity data. See the GeoPandas Installation page for more information.

Option 1: Environment setup using Python

Create and activate a new virtual environment in Python using the commands:

python -m venv [path-to-environment]
python [path-to-environment]/bin/activate

Then install the required dependencies using:

pip install -r requirements.txt

Option 2: Environment setup using Anaconda

Create and activate a new environment in Anaconda with the required dependencies using the commands:

conda env create -f environment.yml
conda activate strava-analysis-tool-env

2. Strava API Access

The tool needs to be registered as an app with Strava to obtain access the Strava API. You can do this as follows:

  1. From https://www.strava.com/settings/api, create a new application and set the 'Authorization Callback Domain' field to localhost.
  2. Copy the generated client ID and store it on your local machine as an environment variable named STRAVA_CLIENT_ID. Do the same for the client secret and store it as an environment variable named STRAVA_CLIENT_SECRET.

When it is first run, the tool will open a browser window and redirect to a Strava app permissions page. Click 'Authorize' to give it access to your Strava data (this includes activities marked as 'private'). Note that only read permissions are requested; the tool is not capable of adding, modifying, or deleting any activities from your personal profile.

After authorizing access, the browser will redirect to an invalid page (http://localhost) and return an error. The returned URL, however, is still valid and contains the access code required for the tool to authenticate itself with the Strava API. The URL will be of the form:

http://localhost/?state=&code=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&scope=read,activity:read_all

When prompted, copy the code portion of the URL (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) and paste it into the console. The tool will get and refresh its own OAuth2 tokens, so this only needs to be done once.

3. HERE account

You will need to register for a free HERE platform account here if you want the tool to leverage the capabilities of HERE Studio. HERE Studio provides a very slick way to visualise your Strava data with a variety of map styles and customized formatting rules. Here's a basic example:

Demo Activity Map

Once configured, the tool can automatically upload your Strava data to HERE to generate an up-to-date map of your activities. You can set rules to colour-code activities (by type or moving time, for instance) within the HERE Studio web app, and clicking on an activity will bring up some useful basic information (try it!).

After creating an account, create a new HERE project + app and generate OAuth credentials as follows:

  1. From the main HERE platform page, click on 'HERE Studio'.
  2. Click on 'Create new map' and give your map a name. This will also create a HERE project with the same name.
  3. Return to the main HERE platform page, click on 'Access Manager', then navigate to the 'Apps' tab at the top of the page.
  4. Click on 'Register new app', then give it a name (e.g. 'Strava Analysis Tool').
  5. In the 'Default access to a project' section, select the project (map) you created in HERE Studio then click 'Register'.
  6. Click on the app you just created, then create a new set of OAuth 2.0 credentials using the 'Create credentials' button. Download and save the generated file to the /Credentials folder in your local copy of this repository.

Usage

Run the tool using the command:

python strava_analysis_tool.py

The following command line options are available:

Command Description
-a / --activity_counts_plot Generate and display a plot of activity counts over time
-c / --commute_plots Generate and display plots of the commute data
-d / --mean_distance_plot Generate and display a plot of the mean activity distance over time
-g / --export_geo_data Export the geospatial activity data in GeoJSON format
-gu / --export_upload_geo_data Export the geospatial activity data in GeoJSON format and upload it to the HERE XYZ mapping platform
-l / --start_locations_plot Generate and display a plot of the number of activities started in each country
-m / --moving_time_heatmap Generate and display a heatmap of moving time for each activity type
-r / --refresh_data Get and store a fresh copy of the activity data
--date_range_start Specify the start of a date range in ISO format
--date_range_end Specify the end of a date range in ISO format

These options can also be displayed from within the command line using the help command:

python strava_analysis_tool.py -h or python strava_analysis_tool.py --help

All user-configurable parameters, such as file paths and the colour palette used to generate any plots, are stored in the file config.toml.

Plots

From release v1.2.0 onwards, the tool is capable of generating some basic plots from your Strava data. The types of plots currently supported are described in the release notes, but here are some examples:

Demo Activity Counts Plot

Demo Commute Plots

Demo Mean Distance Plot

Demo Start Locations Plot

Demo Moving Time Heatmap Plot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].