Skip to content

open-public-transport/open-public-transport-analytics

Repository files navigation

Issues


Logo

Open Public Transport (Analytics)

Analytics of Open Public Transport data

About The Project

tbd

Built With

  • tbd

Installation

Initialize the submodules of this repository by running the following commands.

git submodule init
git submodule update

Install Anaconda

brew install --cask anaconda
export PATH="/usr/local/anaconda3/bin:$PATH"

Install osmnx.

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx

BEWARE: Make sure that any venv is deactivated which can be done by deactivate. BEWARE: Make sure that you only activate the ox environment using conda activate ox.

Install GDAL bindings.

brew install gdal
pip download GDAL
tar -xpzf GDAL-*.tar.gz
cd GDAL-*
python setup.py build_ext --gdal-config /usr/local/Cellar/gdal/*/bin/gdal-config
python setup.py build
python setup.py install

Install the following dependencies to fulfill the requirements for this project to run.

python -m pip install --upgrade pip
pip install flake8 pytest
pip install geojson
pip install tdqm
pip install GDAL
pip install networkx
pip install shapely
pip install geopy
pip install peartree
pip install fastapi
pip install osm2geojson
pip install google-cloud-storage

Usage (prepare)

Run this command to download data.

cd data
python main.py

Usage (analysis)

Run this command to start the main script.

python main.py [OPTION]...

  -h, --help                           show this help
  -c, --clean                          clean intermediate results before start
  -q, --quiet                          do not log outputs
  -p, --points                         number of sample points to use

Examples:
  python main.py -c -p 10000

Usage (web server)

Run this command to run the web server locally.

cd ./app
python app.py --reload

Open http://localhost:8000/docs#/ to see the OpenAPI specification.

Usage (local docker)

Run this command to run the docker container locally.

docker build -t open-public-transport .
docker run -p 8080:8000 open-public-transport

Usage (docker deployment)

Run this command to deploy the Docker image to Google Cloud.

gcloud auth login
gcloud config set project open-public-transport
gcloud builds submit --tag gcr.io/open-public-transport/open-public-transport-backend

Fix graphml files

In some occasions graphml files created by peartree cannot be loaded since their IDs have a weird format, such as _

cd results/results/<CITY>/graphs/peartree
sed -E -i '.bak' 's/\"[A-z0-9 ]+[_de]+([0-9]*):*([0-9]*):*([0-9]*):*([0-9]*):*([0-9]*)[_G]*\"/\1\2\3\4\5\"/g' <GRAPH_FILE>

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Follow our contribution guidelines.

Funding

Between September 2021 through February 2022 this project is founded by German Federal Ministry of Education and Research and supported by Prototype Fund.

Logo Logo

License

Distributed under the GPLv3 License. See LICENSE.md for more information.

Contact

[email protected]

About

Analytics part of Open Public Transport

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published