This readme contains all information to the betweeness centrality analysis with openrouteservice and create the 15min City index
TOC Steps overviewOverview
Setup ORS for centrality analysis for walking profiles for the following cities:
The main repo of openrouteservice does not yet include functionality to export its graph, that’s why we have to checkout the feature branch and built the docker image locally.
git clone https://github.com/GIScience/openrouteservice.git
cd openrouteservice
git checkout feature/export-endpoint
docker build . -t openrouteservice/openrouteservice:graph_export
https://github.com/GIScience/openrouteservice/blob/master/docker/docker-compose.yml
wget http://download.geofabrik.de/europe/germany-latest.osm.pbf
osmium extract -b 8.256,49.363,8.669,49.604 germany-latest.osm.pbf -o osm_file_ma.pbf --overwrite
wget http://download.geofabrik.de/europe/spain/cataluna-latest.osm.pbf
osmium extract -b 1.501,41.04,2.549,41.751 cataluna-latest.osm.pbf -o osm_file_bc.pbf --overwrite
osmium merge osm_file_ma.pbf osm_file_bc.pbf -o osm_file.pbf --overwrite
ORS_UID=${UID} ORS_GID=${GID} docker-compose up
http://localhost:12345/ors/v2/health
By default only car profiles are activated.
Edit the config file located at conf/ors-config.json
Add “walking” in the array active
in line 94:
"init_threads": 1,
"attribution": "openrouteservice.org, OpenStreetMap contributors",
"elevation_preprocessed": false,
"profiles": {
"active": [
"walking"
],
if you are interested in cycling and car profiles you can add “bike-regular” and “car” as well separated by a comma.
Urban green space data used within the scope of this project is based on existing research and methods by Christina Ludwig.
The source code to produce the urban greenness polygons can be found here: https://github.com/redfrexx/green_index
Behind the following link you find geopackages for Mannheim and Barcelona preprocessed:
make sure to put them in the following path project_folder/data/greenness
R is used with the version 4.2.1
on a Ubuntu 22.04 OS. The main libraries comprise:
c("tidyverse","sf","sfnetworks","geojsonsf")
In the folder root folder of this repository you find a R project file gree_15min_city.Rproj
which make path handling easy.
In the src
folder are three scripts located:
prepare_aoi_pts.R
centrality_calc.R
postprocess_aggregation
in the subfolder aux/
you find additional scripts with helper / utils functions to conveniently download OpenStreetMap data and extract the routing graph from openrouteservice.
download_ohsome.R
provides you with a function to fire requests against the endpoints of the ohsome apicentrality_utils.R
provides you with functions to extract a routing graph and parse it to R ready sf dataframe and sfnetwork classesWe start with prepare_aoi_pts.R
which creates the AOI boundaries and neighborhood locations.
landuse in (industrial,forest,farmland,meadow,cemetery,grassland,grass,railway) or natural in (beach,water, scrub, wood) or leisure=marina"
data/input/
as these are the inputs for the subsequents scripts.The centrality analysis is executed via the script centrality_calc.R
.
data/topics.json
sfnetwork
framework to calculate shortest paths to the closest 3 service provision pois. The segments used for the trips are then aggregated.data/centrality_layers
The analysis is repeated for every subtopic, creating a separate output.
Post process aggregations on neighborhood and segment level are executed within postprocess_aggregation.R
THis script consecutively uses the outputs of centrality_calc.R
. All subtopic centrality by segment outputs are aggregated in the first part of the script.
The second part imports the neighborhoods and merges all subtopics into one data frame. Based on walking speeds differentiated by age group the minimum distance to the closest subtopic poi is evaluated whether reachable within 15 minutes or not. This binary indicator is then aggregated across the subtopics. The highest score for a neighborhood given the 9 subtopics therefore is 9.
Final output of the betweenness centrality and 15minute city index analysis are:
<AOI identifier>_graph_centrality.gpkg
<AOI identifier>_15mc_index.gpkg
These are then further used in the python workflow to add greenness to the segments and feed both datasets into visualization.