Growing Urban Bicycle Networks

Source code for the paper Growing Urban Bicycle Networks, exploring algorithmically the limitations of urban bicycle network growth.
https://github.com/mszell/bikenwgrowth

Category: Consumption
Sub Category: Mobility and Transportation

Keywords

bicycle-network cycling gis network-analysis openstreetmap osmnx transportation-network urban-data-science urban-planning

Last synced: about 2 hours ago
JSON representation

Repository metadata

Source code for the paper "Growing urban bicycle networks", exploring algorithmically the limitations of urban bicycle network growth

README.md

Growing Urban Bicycle Networks

This is the source code for the scientific paper Growing urban bicycle networks by M. Szell, S. Mimar, T. Perlman, G. Ghoshal, and R. Sinatra. The code downloads and pre-processes data from OpenStreetMap, prepares points of interest, runs simulations, measures and saves the results, creates videos and plots.

Paper: https://www.nature.com/articles/s41598-022-10783-y
Data repository: zenodo.5083049
Visualization: GrowBike.Net
Videos & Plots: https://growbike.net/download

Video output from running the code on Paris, showing the growth of a bicycle network on a grid of seed points
Video output from running the code on Paris, showing the growth of a bicycle network on a grid of seed points

Instructions

1. Git clone the project without the full history

Run from your terminal:

git clone -b main --single-branch https://github.com/mszell/bikenwgrowth --depth 1

2. Install the conda environment growbikenet

In your terminal, navigate to the project folder bikenwgrowth and use conda
or mamba
or micromamba to run:

mamba env create -f environment.yml
mamba activate growbikenet

Environment creation from command line

If the above doesn't work, you can manually create the environment from your command line (not recommended):

mamba create --override-channels -c conda-forge -n growbikenet python=3.12 osmnx=1.9.4 python-igraph watermark haversine rasterio tqdm geojson
mamba activate growbikenet
mamba install -c conda-forge ipywidgets
pip install opencv-python
pip install --user ipykernel

Set up Jupyter kernel

If you want to use the environment growbikenet in Jupyter, run:

python -m ipykernel install --user --name=growbikenet

This allows you to run Jupyter with the kernel growbikenet (Kernel > Change Kernel > growbikenet)

3a. Run the code locally

Single (or few/small) cities can be run locally by a manual, step-by-step execution of Jupyter notebooks:

  1. Populate parameters/cities.csv, see below. Leave default values to run the code on two small cities.
  2. Navigate to the code folder.
  3. Run notebooks 01 and 02 once to download and prepare all networks and POIs.
  4. Run notebooks 03, 04, 05 for each parameter set (see below), set in parameters/parameters.py
  5. Optional: Run 06 to create videos.
  6. Optional: Further notebooks named with X_ can be run if needed to generate extra results or data.

3b. Run the code on an HPC cluster with SLURM

For multiple, esp. large, cities, running the code on a high performance computing cluster is strongly suggested as the tasks are easy to paralellize. The shell scripts are written for SLURM.

  1. Populate parameters/cities.csv, see below.
  2. Run 01 and 02 once locally to download and prepare all networks and POIs (The alternative is server-side sbatch scripts/download.job, but OSMNX throws too many connection issues, so manual supervision is needed)
  3. Upload code/*.py, parameters/*, scripts/*
  4. Run: ./mastersbatch_analysis.sh
  5. Run, if needed: ./mastersbatch_export.sh
  6. After all is finished, run: ./cleanup.sh
  7. Recommended, run: ./fixresults.sh (to clean up results in case of amended data from repeated runs)

Folder structure and output

The main folder/repo is bikenwgrowth, containing Jupyter notebooks (code/), preprocessed data (data/), parameters (parameters/), result plots (plots/), HPC server scripts and jobs (scripts/).

Most of the generated data output (network plots, videos, results, exports, logs) makes up many GBs and is stored in the separate external folder bikenwgrowth_external. To set up different paths, edit code/path.py

Parameter sets

  1. prune_measure = "betweenness", poi_source = "railwaystation"
  2. prune_measure = "betweenness", poi_source = "grid"
  3. prune_measure = "closeness", poi_source = "railwaystation"
  4. prune_measure = "closeness", poi_source = "grid"
  5. prune_measure = "random", poi_source = "railwaystation"
  6. prune_measure = "random", poi_source = "grid"

Populating cities.csv

Checking nominatimstring

Acquiring shape file

  • Go to Overpass, to the city, and run:
    relation["boundary"="administrative"]["name:en"="Copenhagen Municipality"]({{bbox}});(._;>;);out skel;
  • Export: Download as GPX
  • Use QGIS to create a polygon, with Vector > Join Multiple Lines, and Processing Toolbox > Polygonize (see Stackexchange answer 1 and Stackexchange answer 2)

Citation (CITATION.cff)

cff-version: 1.0.0
message: "If you use this source code, please cite it as below."
authors:
- family-names: "Szell"
  given-names: "Michael"
  orcid: "https://orcid.org/0000-0003-3022-2483"
- family-names: "Mimar"
  given-names: "Sayat"
- family-names: "Perlman"
  given-names: "Tyler"
- family-names: "Ghoshal"
  given-names: "Gourab"
- family-names: "Sinatra"
  given-names: "Roberta"
title: "Growing urban bicycle networks"
version: 1.0.0
date-released: 2021-07-08
url: "https://github.com/mszell/bikenwgrowth"
preferred-citation:
  type: article
  authors:
  - family-names: "Szell"
    given-names: "Michael"
    orcid: "https://orcid.org/0000-0003-3022-2483"
  - family-names: "Mimar"
    given-names: "Sayat"
  - family-names: "Perlman"
    given-names: "Tyler"
  - family-names: "Ghoshal"
    given-names: "Gourab"
  - family-names: "Sinatra"
    given-names: "Roberta"
  doi: "10.1038/s41598-022-10783-y"
  journal: "Scientific Reports"
  start: 1
  end: 14 
  title: "Growing urban bicycle networks"
  issue: 6765
  volume: 12
  year: 2022

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 189
Total Committers: 5
Avg Commits per committer: 37.8
Development Distribution Score (DDS): 0.111

Commits in past year: 26
Committers in past year: 3
Avg Commits per committer in past year: 8.667
Development Distribution Score (DDS) in past year: 0.231

Name Email Commits
Michael Szell m****l@g****m 168
TylerPerlman 6****n 14
anvy a****y@i****k 5
Flo Edelmann g****t@f****e 1
tocunha t****7@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 21
Total pull requests: 8
Average time to close issues: 7 months
Average time to close pull requests: 12 minutes
Total issue authors: 7
Total pull request authors: 3
Average comments per issue: 1.81
Average comments per pull request: 0.75
Merged pull request: 6
Bot issues: 0
Bot pull requests: 0

Past year issues: 17
Past year pull requests: 6
Past year average time to close issues: 4 days
Past year average time to close pull requests: 17 minutes
Past year issue authors: 3
Past year pull request authors: 3
Past year average comments per issue: 1.53
Past year average comments per pull request: 1.0
Past year merged pull request: 4
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/mszell/bikenwgrowth

Top Issue Authors

  • anastassiavybornova (12)
  • mszell (4)
  • ManuelBanza (1)
  • JoaoCarabetta (1)
  • Froguin99 (1)
  • cbueth (1)
  • FloEdelmann (1)

Top Pull Request Authors

  • mszell (4)
  • RogerGMarch (2)
  • anastassiavybornova (2)

Top Issue Labels

  • future-request (8)
  • bug (4)

Top Pull Request Labels


Dependencies

requirements.txt pypi
  • Fiona ==1.8.18
  • GDAL ==3.1.4
  • Jinja2 ==2.11.2
  • Pygments ==2.6.1
  • Send2Trash ==1.5.0
  • Shapely ==1.7.0
  • affine ==2.3.0
  • appnope ==0.1.0
  • async-generator ==1.10
  • backcall ==0.1.0
  • backports.functools-lru-cache ==1.6.1
  • brotlipy ==0.7.0
  • certifi ==2020.12.5
  • click ==7.1.2
  • click-plugins ==1.1.1
  • cycler ==0.10.0
  • decorator ==4.4.2
  • defusedxml ==0.6.0
  • descartes ==1.1.0
  • geojson ==2.5.0
  • haversine ==2.2.0
  • ipykernel ==5.3.0
  • ipython ==7.14.0
  • ipython-genutils ==0.2.0
  • jedi ==0.17.0
  • jupyter-client ==6.1.3
  • jupyter-core ==4.6.3
  • munch ==2.5.0
  • opencv-python ==4.4.0.42
  • pandas ==1.0.3
  • pandocfilters ==1.4.2
  • parso ==0.7.0
  • pexpect ==4.8.0
  • pickleshare ==0.7.5
  • prompt-toolkit ==3.0.5
  • ptyprocess ==0.6.0
  • pycairo ==1.20.0
  • pyparsing ==2.4.7
  • python-dateutil ==2.8.1
  • pyzmq ==19.0.1
  • scipy ==1.4.1
  • snuggs ==1.4.7
  • testpath ==0.4.4
  • traitlets ==4.3.3
  • watermark ==2.0.2
  • wcwidth ==0.1.9
  • webencodings ==0.5.1
requirements_nonbuiltins.txt pypi
  • csv >=1.0
  • fiona >=1.8.18
  • geojson >=2.5.0
  • geopandas >=0.8.1
  • haversine >=2.3.0
  • igraph >=0.8.3
  • matplotlib >=3.3.3
  • networkx >=2.5
  • numpy >=1.19.4
  • osmnx ==0.16.2
  • pandas >=1.0.3
  • pyproj >=2.6.1.post1
  • shapely >=1.7.0
  • tqdm >=4.55.0
  • watermark >=2.0.2
code/setup.py pypi
environment.yml pypi
  • opencv-python *

Score: 6.016157159698354