diff --git a/Makefile b/Makefile index eb42337..c746f16 100644 --- a/Makefile +++ b/Makefile @@ -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 + diff --git a/README.md b/README.md index ae43ea3..219d534 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/docker/brouter/.gitignore b/docker/brouter/.gitignore index 98f415b..0dc77db 100644 --- a/docker/brouter/.gitignore +++ b/docker/brouter/.gitignore @@ -9,5 +9,6 @@ # Except docker-compose.yml !docker-compose.yml -# Except safety profiles -!safety.brf +# Except osm_edit +!osm_edit/ +!mapcreation/* \ No newline at end of file diff --git a/docker/brouter/osm_edit/.gitignore b/docker/brouter/osm_edit/.gitignore new file mode 100644 index 0000000..899c425 --- /dev/null +++ b/docker/brouter/osm_edit/.gitignore @@ -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 \ No newline at end of file diff --git a/docker/brouter/osm_edit/brouter-tmp/.gitignore b/docker/brouter/osm_edit/brouter-tmp/.gitignore new file mode 100644 index 0000000..64f5877 --- /dev/null +++ b/docker/brouter/osm_edit/brouter-tmp/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* + +# Except this file +!.gitignore diff --git a/docker/brouter/osm_edit/docker-compose.yml b/docker/brouter/osm_edit/docker-compose.yml new file mode 100644 index 0000000..e37f5cc --- /dev/null +++ b/docker/brouter/osm_edit/docker-compose.yml @@ -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 diff --git a/docker/brouter/osm_edit/pbf_files/.gitignore b/docker/brouter/osm_edit/pbf_files/.gitignore new file mode 100644 index 0000000..64f5877 --- /dev/null +++ b/docker/brouter/osm_edit/pbf_files/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* + +# Except this file +!.gitignore diff --git a/docker/brouter/osm_edit/segments/.gitignore b/docker/brouter/osm_edit/segments/.gitignore new file mode 100644 index 0000000..64f5877 --- /dev/null +++ b/docker/brouter/osm_edit/segments/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* + +# Except this file +!.gitignore diff --git a/docker/brouter/osm_edit/srtm3/.gitignore b/docker/brouter/osm_edit/srtm3/.gitignore new file mode 100644 index 0000000..c8b8738 --- /dev/null +++ b/docker/brouter/osm_edit/srtm3/.gitignore @@ -0,0 +1,8 @@ +# Ignore everything in this directory +* + +# Except this file +!.gitignore + +# Except srtm_tiles.csv +!srtm_tiles.csv diff --git a/docker/brouter/osm_edit/srtm3/srtm_tiles.csv b/docker/brouter/osm_edit/srtm3/srtm_tiles.csv new file mode 100644 index 0000000..29c621e --- /dev/null +++ b/docker/brouter/osm_edit/srtm3/srtm_tiles.csv @@ -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