Analyze NextBike trips in your city: collect, process, and visualize bike trips.
- collection/ # Setup data collection
- data/ # Stored trips data
- docs/ # Documentation
- processing/ # Calculate trips
- visualization/ # Web visualization
- Docker (Install Docker)
- Python 3.12
Validates the project locally.
To properly setup data collection and processing, refer to the README files in collection/
and processing/
directories.
-
Clone repository:
git clone https://github.com/zwoefler/nextbike-city-analysis.git cd nextbike-city-analysis
-
Setup data collection:
cd collection cp .env.example .env docker build --file CONTAINERFILE -t nextbike_collector:multiple_cities . docker compose --file docker-compose.yaml up -d cd ..
-
Define city and date:
# Sets todays date date=$(date +%Y-%m-%d) city_id=467
-
Process trips:
⚠ Wait a few minutes. As trips have to accumulate first. Otherwise you will encounter errors.
cd processing cp .env.example .env docker build --file CONTAINERFILE -t nextbike-processing:latest . docker run --rm --env-file .env \ -e DB_HOST=nextbike_postgres \ --network collection_nextbike_network \ -v "$(pwd)/../data/:/app/data" \ nextbike-processing:latest \ --city-id $city_id --export-folder /app/data --date $date cd ..
-
Visualize trips:
cd visualization python3 -m http.server 8000
-
Open
localhost:8000
in your browser.
- Update the data in the
data/
directory. - Run the
update-gh-pages.sh
script
Changes will sync with master. Only the data/
directory will be pushed to the gh-pages branch. Not the master branch.
Inspired by 36c3 - Verkehrswende selber hacken by ubahnverleih & robbie5.
Visualization inspired by Technologiestiftung Berlin: