Welcome to the Network Analysis project! This Python project is designed for analyzing and visualizing the betweeness centrality of road networks using various tools and libraries.
To set up the project, follow the steps below for a hassle-free installation. This project utilizes Python and Anaconda for environment management
Before you begin, ensure that you have Python and Anaconda installed on your system. If not, you can download and install Anaconda from Anaconda's official website.
Clone the Repository:
git clone https://courses.gistools.geog.uni-heidelberg.de/mh220/05_network_analysis.git
cd 05_network_analysis
Create and Activate Conda Environment:
conda env create -f environment.yml
conda activate network_analysis
Now, your environment is configured, and you're ready to run and contribute to the project!
The project requires raster data for the population-weighted geographical centrality analysis. In this project the GHS population grid is used. The data is available on the here. Download the data, extract it and place the .tif-file in the data
folder as ghspop_4326.tif
.
The project is called via the CLI, navigate to the src
directory and run the following command:
cd src
python main.py -l "Heidelberg, Germany" -m "networkx" -n 5 -r "length" -o "output_results" -t "drive"
The following parameters are available:
Parameter | Short Option | Long Option | Type | Choices | Default Value | Description |
---|---|---|---|---|---|---|
Study Area Location | -l | --location | String | "Dossenheim, Germany" | Study area, e.g., 'Heidelberg, Germany' (default: 'Heidelberg, Germany') | |
Centrality Method | -m | --centrality_method | String | "networkx" or "geographical" | "networkx" | Method to calculate centrality (default: networkx) |
Number of Routes | -n | --num_outes | Int | - | Number of routes (only for the networkx method) | |
Route Type | -r | --route_type | String | "length" or "travel_time" | "length" | Route type, optional, default: length |
Output Folder | -o | --output_folder | String | "output_results" | Output folder for results (default: output_results) | |
Network Type | -t | --network_type | String | "all_private", "all", "bike", "drive", "drive_service", "walk" | "drive" | Type of street network (default: drive) |
Weighting Method | -w | --weighting | String | "random" or "population" | - | Weighting method for geographical centrality (default: random) |
- Python (>=3.10)
- NetworkX (>=3.1)
- pytest (>=7.4.0)
- OSMnx (>=1.6.0)
- Matplotlib (>=3.7.2)
- Jupyter (>=1.0.0)
- Mock (>=5.1.0)
- GeoPandas (>=0.10.2)
If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request. Contributions are welcome!
Enjoy exploring and analyzing networks with the Network Analysis project!
Calculate the betweenness centrality for the study area Heidelberg, Germany for the shortest paths for all roads accessible with the car.
cd src
python main.py -l "Heidelberg, Germany" -m "networkx" -r "length" -o "output_results" -t "drive"
Calculate the betweenness centrality for the study area Heidelberg, Germany for the shortest travel time for 5 random selected paths for all roads accessible with the car.
cd src
python main.py -l "Heidelberg, Germany" -m "geographical" -n 5 -r "travel_time" -o "output_results" -t "drive" -w "random"
Calculate the betweenness centrality for the study area Heidelberg, Germany for the shortest path for 5 paths selected based on the population for all roads accessible with a bike.
cd src
python main.py -l "Heidelberg, Germany" -m "geographical" -n 5 -r "length" -o "output_results" -t "bike" -w "population"