Skip to content

Automated detection of gaps in bicycle networks: source code for IPDC procedure

License

Notifications You must be signed in to change notification settings

anastassiavybornova/bikenwgaps

Repository files navigation

Automated Detection of Missing Links in Bicycle Networks

This is the source code for the scientific article Automated Detection of Missing Links in Bicycle Networks by A. Vybornova, T. Cunha, A. Gühnemann and M. Szell. The code runs the IPDC procedure (Identify, Prioritize, Decluster, Classify), as presented in the article, for the use case of Copenhagen.

Publication: https://doi.org/10.1111/gean.12324

Preprint: https://arxiv.org/abs/2201.03402

Visualization (map): FixBike.Net

Visualization (table): FixBike.Net/table

Workflow demonstration: Copenhagen

The code presented here pre-processes Copenhagen data from OpenStreetMap (see below) and executes the all four steps of the IPDC procedure (Identify, Prioritize, Decluster, Classify). The last step (Classify) requires a manual classification of automatically identified gaps. The code is applied to the use case of Copenhagen to demonstrate the workflow, but can be easily modified for application to any other city - see instructions in the last part of the readme.

Folder structure

The main folder/repo is bikenwgaps. It contains:

  • Jupyter notebooks with code: 00_import, 01_IP, 02_DC, 03_PLOT
  • _compare: subfolder with code output as generated if all 3 notebooks are run successfully
  • /analysis/: subfolder with gap classification data for Copenhagen (to reproduce plots)
  • /data/: subfolder with OSM data (in csv file format) as imported in 00_import
  • /fixbikenet/: subfolder with all html and image sources for FixBike.Net and FixBike.Net/table
  • packages.py: list of packages imported within each notebook
  • parameters_plot.py: list of plot parameters imported for plotting
  • requirements.txt: required packages for setting up the code environment

All output from the code is saved to the subfolders ./data/pickle/, ./analysis/, and ./results/. Once all output is generated, the notebooks can be re-run independently from each other (in any order).

Running binder

badge

Running on your local machine

Setting up code environment

The required python version is 3.8.8. pip must be installed and updated before setting up the environment. requirements.txt must be placed in the working directory. For issues that may arise with geopandas dependencies on windows, we refer our fellow sufferers to this blogpost by Geoff Boeing.

conda create --override-channels -c conda-forge -n bnwenv shapely
conda activate bnwenv
pip install -r requirements.txt 
conda install -c conda-forge ipywidgets
pip install --user ipykernel 
python -m ipykernel install --user --name=bnwker

Running the jupyter notebooks

Run jupyter notebook with bnwker (Kernel > Change Kernel > bnwker) and make it trusted (Not Trusted > Trust). Run the notebooks in the indicated order:

  • 00_import
  • 01_IP
  • 02_DC
  • 03_PLOT

Using the workflow: Application to other cities

The code can be easily modified for application to any other city. Steps to take:

  • Before running 00_import - change the input data (csv files generated from OpenStreetMap)
  • Run 00_import, adjusting file names for import, and verify if largest connected component is accurately represented
  • Run 01_IP, adjusting D_min (detour factor) if needed (default: D_min = 1.5)
  • Run 02_DC, adjusting B_cutoff (benefit cutoff) if needed (default: B_cutoff = 15300) and the coordinates for map centering (default is mycity_coord = [55.6761, 12.5683] for Copenhagen)
  • Manually classify the gaps
    • use "./analysis/gaps_declustered_table.csv" and "./analysis/gaps_declustered_plot.html" generated for your city* column "class": enter gap class (e.g. "BR" for bridge, "ST" for street, etc.)
    • if gap is not confirmed (data issue/error): leave "class" cell for that row empty
    • columns "address" and "comments": optional
    • save edited csv table as "./analysis/gaps_classified_table.csv" (replacing the existing file of Copenhagen data)
    • table is imported in the next step (notebook 03_PLOT) for visualization of results
  • Run 03_PLOT, adjusting coordinates for map centering and (if needed) adjusting gap colours and classes