Merge pull request #21 from bvarick/whatif

Adds what-if data processing
This commit is contained in:
bvarick 2025-02-04 14:49:42 -06:00 committed by GitHub
commit f05a478aa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 93 additions and 2 deletions

View File

@ -43,3 +43,17 @@ brouter-data:
cd ./docker/brouter/brouter-web; cp keys.template.js keys.js;
cd ./docker/brouter/brouter-web; cp config.template.js config.js
cd ./docker/brouter; docker compose build
osm_edit_refresh_base:
cd ./docker/brouter/osm_edit; wget https://download.geofabrik.de/north-america/us/wisconsin-latest.osm.pbf -O ./pbf_files/wisconsin-latest.osm.pbf
cd ./docker/brouter/osm_edit/srtm3/; wget -i srtm_tiles.csv -P ./
osm_edit_generate_pbf:
cd ./docker/brouter/; docker run -v ./osm_edit:/osm_edit ghcr.io/bvarick/osmium-tool:2.21.0 osmium apply-changes /osm_edit/pbf_files/wisconsin-latest.osm.pbf /osm_edit/changes.osc -o /osm_edit/pbf_files/wisconsin-latest_edited.osm.pbf --overwrite
osm_edit_generate_brouter:
docker run --rm --user "$(id -u):$(id -g)" --env PLANET=wisconsin-latest_edited.osm.pbf --env JAVA_OPTS="-Xmx2048M -Xms2048M -Xmn256M" --env PLANET_UPDATE=0 --volume ./docker/brouter/osm_edit/brouter-tmp:/brouter-tmp --volume ./docker/brouter/osm_edit/pbf_files:/planet --volume ./docker/brouter/osm_edit/srtm3:/srtm3:ro --volume ./docker/brouter/osm_edit/segments:/segments ghcr.io/mjaschen/brouter-routingdata-builder
osm_edit_brouter_containers:
cd ./docker/brouter/osm_edit; docker compose up -d

View File

@ -34,6 +34,17 @@ calculates the walking routes using OSRM.
- `make cycle-osrm` will run *cycling_route_analysis.Rmd* which calculates the biking routes using OSRM.
- `make cycle-brouter` will run *cycling_route_analysis_brouter.Rmd* which calculates the biking routes using brouter.
## What-if analysis
This allows you to make changes to the street network (add a bike path, reduce a lane on an arterial street) and see how it affects the routes that brouter chooses.
This is a multi-step process:
1. Generate an OsmChange file for the changes that you want to analyze. Don't upload your hypothetical infrastructure to OpenStreetMap!
2. Save that file as `docker/brouter/osm_edit/changes.osc`.
3. `make osm_edit_refresh_base` will download a fresh copy of `wisconsin-latest.osm.pbf` and the elevation tiles for Wisconsin. You don't need to run this frequently.
4. `make osm_edit_generate_pbf` will take those edits and apply them to the `wisconsin-latest.osm.pbf` and generate `wisconsin-latest_edited.osm.pbf`
5. `make osm_edit_generate_brouter` will generate new brouter segment files from the edited pbf file.
6. `make osm_edit_brouter_containers` starts the brouter backend and frontend using your newly created segment files with the edits you made. You can access the webui at http://127.0.0.1:8080
## Misc.
- [Bike Level of Traffic Stress (LTS)](https://www.dvrpc.org/webmaps/bike-lts/analysis/)

View File

@ -9,5 +9,6 @@
# Except docker-compose.yml
!docker-compose.yml
# Except safety profiles
!safety.brf
# Except osm_edit
!osm_edit/
!mapcreation/*

12
docker/brouter/osm_edit/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
# Except osm_edit directories
!pbf_files/
!srtm3/
!brouter-tmp/
!segments/
!docker-compose.yml

View File

@ -0,0 +1,5 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,26 @@
---
services:
brouter:
container_name: brouter
ports:
- 17777:17777
volumes:
- ./segments:/segments4
image: brouter
build:
context: ../brouter
dockerfile: Dockerfile
---
services:
brouter-web:
container_name: brouter-web
ports:
- 127.0.0.1:8080:80
volumes:
- ../brouter-web/config.js:/usr/share/nginx/html/config.js
- ../brouter-web/keys.js:/usr/share/nginx/html/keys.js
- ../brouter-web/profiles:/usr/share/nginx/html/profiles
image: brouter-web
build:
context: ../brouter-web
dockerfile: Dockerfile

View File

@ -0,0 +1,5 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,5 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,8 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
# Except srtm_tiles.csv
!srtm_tiles.csv

View File

@ -0,0 +1,4 @@
https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ASCII/srtm_18_03.zip
https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ASCII/srtm_18_04.zip
https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ASCII/srtm_19_03.zip
https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ASCII/srtm_19_04.zip
1 https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ASCII/srtm_18_03.zip
2 https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ASCII/srtm_18_04.zip
3 https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ASCII/srtm_19_03.zip
4 https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/ASCII/srtm_19_04.zip