NextBike trip analysis for your city. Collect, process and visualize bike trips in your City.
This project pulls data from the public Nextbike API and aggreagtes it into "trips". Then the data can be previewed on a map. Or you can use the data in csv format to do your own analysis in Excel.
- collection/ # Setup Nextbike API data collection on a server
- data/ # Nextbike trips data
- docs/ # Documentation
- processing/ # Calculate trips from data in database
- visualization/ # Webpage to visualize the trips
- Docker (for containerized setup. See Install Docker)
- Python 3.12
- Clone Repository:
git clone [email protected]:zwoefler/nextbike-city-analysis.git
- Change directory:
cd nextbike-city-analysis/
- Change into directory for development.
collection/
orprocessing/
- Create python virtual environment:
python3 -m venv Env
source Env/bin/activate
pip install -r requirements.txt
- Clone repo:
git clone https://github.com/zwoefler/nextbike-city-analysis.git
cd nextbike-city-analysis
- Setup data collection:
# Change directory into collection
cd collection
# Copy the fake env vars
cp .env.example .env
# Start data aggregation in background. Pulls & builds the images
docker compose --file docker-compose.yaml up -d
# cd back to project root
cd ..
- Set city_id and date to today as shell variables:
# Use format YYYY-MM-DD.
date='2025-01-07'
city_id=467
- Calculate trips (Wait a few minutes before execution):
cd data_processing
python3 -m nextbike_processing.main --city-id $city_id --export-folder ../data/trips_data/ --date $date
cd ..
- Visualize trips:
# Copy data to visualization data
cp "data/trips_data/${city_id}_trips_${date}.json" visualization/data/
cp "data/trips_data/${city_id}_stations_${date}.json" visualization/data/
Change into visualization/
and sstart the server to display the map:
python3 -m http.server 8000
- Visit
localhost:8000
in your browser.
Inspiration: 36c3 - Verkehrswende selber hacken talk by
- ubahnverleih and
- robbie5
🫵🏽 Check them out. An absolute treasure for mobility focused IT projects!
Technical inspiration from the great visualization by Technologiestiftung Berlin. Especially their two projects: