Parse HSL City Bike ride history and export rides as GPX or TCX files for Strava
Project description
HSL Kaupunkipyörä Exporter
Parse your HSL City Bike ride history and export each ride as a Strava-compatible TCX or GPX file.
Installation
Requires Python 3.13+. The easiest way to run the tool is via uvx:
uvx hsl-kaupunkipyora-exporter rides.txt
Or install with pip:
pip install hsl-kaupunkipyora-exporter
hsl-kaupunkipyora-exporter rides.txt
Usage
- Open your ride history at https://www.hsl.fi/en/my-information/citybikes/ride-history.
- Save the page as HTML (
Ctrl+S) or copy-paste the visible text into a.txtfile. - Run the exporter:
uvx hsl-kaupunkipyora-exporter rides.html
Path Modes
The exporter supports three distinct modes for handling geographic data:
- Summary Only (Default): Exports a TCX file containing the exact distance and duration reported by HSL, but no GPS trackpoints. This is the most accurate way to record kilometers in Strava without guessing the path.
- Linear Path (
--linear): Includes a simple two-point straight line between the departure and return stations. Useful if you want a basic map visualization. - Routed Path (
--use-route): Fetches the suggested cycling route from the Digitransit API. This provides a realistic path on the map and preserves HSL distance data (when using TCX). Requires a free API key.
Options
| Flag | Description |
|---|---|
--output-dir DIR |
Directory to write files into (default: ./tcx_output) |
--format FMT |
Export format: tcx (default) or gpx. |
--linear |
Include a straight-line path between stations |
--use-route |
Use suggested HSL cycling route instead of a straight line |
--api-key KEY |
Digitransit API key (alternative to DIGITRANSIT_API_KEY env var) |
--refresh-stations |
Force re-download of the bike station coordinate list |
-v, --verbose |
Enable verbose/debug logging |
TCX vs GPX
While GPX is the most common format, it does not support an explicit "total distance" override. Strava calculates distance based on the GPS points provided.
TCX is the default and recommended format because it allows the tool to tell Strava exactly how many kilometers the ride was, regardless of the GPS path.
# Export as TCX with a straight line between stations
uvx hsl-kaupunkipyora-exporter rides.txt --linear
Routed Path Setup
To use the actual cycling route suggested by HSL, you need a Digitransit API key:
- Register for a free key at Digitransit Developer Portal.
- Provide the key via the
--api-keyflag or theDIGITRANSIT_API_KEYenvironment variable.
uvx hsl-kaupunkipyora-exporter rides.txt --use-route --api-key your_key_here
Kilometrikisa
This is a convenient way to add your Alepa Fillari kilometers to Kilometrikisa by importing your rides into Strava first.
Development
Use just to run tasks.
git clone https://github.com/nikosavola/hsl-kaupunkipyora-exporter.git
cd hsl-kaupunkipyora-exporter
just install
just test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hsl_kaupunkipyora_exporter-0.1.1.tar.gz.
File metadata
- Download URL: hsl_kaupunkipyora_exporter-0.1.1.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afbcdec4f3228b54816950bdc867d1a16807fcbfebfc922a2901967bff56c0b4
|
|
| MD5 |
15a13d2b7515f2648100d4e3d3c61753
|
|
| BLAKE2b-256 |
fa910d26190bfb8746c18976d03caa5dc0c505317f797ad2106e87f7661002ba
|
Provenance
The following attestation bundles were made for hsl_kaupunkipyora_exporter-0.1.1.tar.gz:
Publisher:
release.yml on nikosavola/hsl-kaupunkipyora-exporter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hsl_kaupunkipyora_exporter-0.1.1.tar.gz -
Subject digest:
afbcdec4f3228b54816950bdc867d1a16807fcbfebfc922a2901967bff56c0b4 - Sigstore transparency entry: 1357150063
- Sigstore integration time:
-
Permalink:
nikosavola/hsl-kaupunkipyora-exporter@d9a69e276090cad37103510c3d12f458feb895a9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nikosavola
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d9a69e276090cad37103510c3d12f458feb895a9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hsl_kaupunkipyora_exporter-0.1.1-py3-none-any.whl.
File metadata
- Download URL: hsl_kaupunkipyora_exporter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70a3ea9947a5ccb27b50be6f7b53136a8d4664593b48c73c8ee3c926a4f4b487
|
|
| MD5 |
e797bdd48c3269444c33bb79c6323205
|
|
| BLAKE2b-256 |
ee9965998efb8e3981bffc0dc3634bcd08ef16ec4c7d24b57a3c8168e70d95b2
|
Provenance
The following attestation bundles were made for hsl_kaupunkipyora_exporter-0.1.1-py3-none-any.whl:
Publisher:
release.yml on nikosavola/hsl-kaupunkipyora-exporter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hsl_kaupunkipyora_exporter-0.1.1-py3-none-any.whl -
Subject digest:
70a3ea9947a5ccb27b50be6f7b53136a8d4664593b48c73c8ee3c926a4f4b487 - Sigstore transparency entry: 1357150069
- Sigstore integration time:
-
Permalink:
nikosavola/hsl-kaupunkipyora-exporter@d9a69e276090cad37103510c3d12f458feb895a9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nikosavola
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d9a69e276090cad37103510c3d12f458feb895a9 -
Trigger Event:
push
-
Statement type: