Compare commits
11 Commits
8348f5606c
...
ef51272a69
Author | SHA1 | Date | |
---|---|---|---|
|
ef51272a69 | ||
|
dd36d8b957 | ||
|
fe88172a3b | ||
|
378c991c6d | ||
|
104f215a0e | ||
|
24dacb5e6b | ||
|
7993621f9f | ||
|
7932dad4bd | ||
|
2e1c211915 | ||
|
14b8a14284 | ||
|
6455542eac |
2
.gitignore
vendored
2
.gitignore
vendored
@ -21,3 +21,5 @@ trash/
|
||||
api_key
|
||||
R/route_analysis.html
|
||||
log/
|
||||
# Exclude html files generated in the top directory (from RStudio runs)
|
||||
./*.html
|
||||
|
29
Makefile
29
Makefile
@ -1,9 +1,35 @@
|
||||
walk: route_analysis.Rmd
|
||||
R -e 'library("rmarkdown"); old_path <- Sys.getenv("PATH"); Sys.setenv(PATH = paste(old_path, "/usr/local/bin", sep = ":")); rmarkdown::render(knit_root_dir = "./", output_dir = "./html", input = "./route_analysis.Rmd", output_file = "./html/route_analysis.html")'
|
||||
|
||||
cycle: cycling_route_analysis.Rmd
|
||||
cycle_osrm: cycling_route_analysis.Rmd
|
||||
R -e 'library("rmarkdown"); old_path <- Sys.getenv("PATH"); Sys.setenv(PATH = paste(old_path, "/usr/local/bin", sep = ":")); rmarkdown::render(knit_root_dir = "./", output_dir = "./html", input = "./cycling_route_analysis.Rmd", output_file = "./html/cycling_route_analysis.html")'
|
||||
|
||||
cycle_brouter: cycling_route_analysis_brouter.Rmd
|
||||
R -e 'library("rmarkdown"); old_path <- Sys.getenv("PATH"); Sys.setenv(PATH = paste(old_path, "/usr/local/bin", sep = ":")); rmarkdown::render(knit_root_dir = "./", output_dir = "./html", input = "./cycling_route_analysis_brouter.Rmd", output_file = "./html/cycling_route_analysis.html")'
|
||||
|
||||
osrm-container: ./docker/osrm/docker-compose.yml
|
||||
cd ./docker/osrm/; docker compose up -d
|
||||
|
||||
osrm-data:
|
||||
cd ./docker/osrm/; wget https://download.geofabrik.de/north-america/us/wisconsin-latest.osm.pbf -O ./data-raw/wisconsin-latest.osm.pbf
|
||||
cd ./docker/osrm/; docker run -t -v "./data-foot:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-extract -p /opt/foot.lua /data/wisconsin-latest.osm.pbf
|
||||
cd ./docker/osrm/; docker run -t -v "./data-foot:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-partition /data/wisconsin-latest.osrm
|
||||
cd ./docker/osrm/; docker run -t -v "./data-foot:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-customize /data/wisconsin-latest.osrm
|
||||
cd ./docker/osrm/; docker run -t -v "./data-bicycle:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-extract -p /opt/bicycle.lua /data/wisconsin-latest.osm.pbf
|
||||
cd ./docker/osrm/; docker run -t -v "./data-bicycle:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-partition /data/wisconsin-latest.osrm
|
||||
cd ./docker/osrm/; docker run -t -v "./data-bicycle:/data" -v "./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf" osrm/osrm-backend osrm-customize /data/wisconsin-latest.osrm
|
||||
|
||||
brouter-container: ./docker/brouter/docker-compose.yml
|
||||
cd ./docker/brouter; docker compose up -d
|
||||
|
||||
brouter-data:
|
||||
cd ./docker/brouter/; git clone https://github.com/abrensch/brouter.git
|
||||
cd ./docker/brouter/; wget -i segments.csv -P ./brouter/misc/segments4/
|
||||
cd ./docker/brouter/; git clone https://github.com/nrenner/brouter-web.git
|
||||
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
|
||||
|
||||
clean: clean-data clean-figure clean-script
|
||||
|
||||
clean-data:
|
||||
@ -16,3 +42,4 @@ clean-figure:
|
||||
rm -rvf ./figure/
|
||||
|
||||
.PHONY: data
|
||||
|
||||
|
15
README.md
15
README.md
@ -2,7 +2,7 @@
|
||||
This script generates maps to analyze the potential walking routes for students to their school.
|
||||
|
||||
- I excluded the addresses of the students from the repository.
|
||||
- The actual route generation is done with OSRM, I run it locally in a docker container.
|
||||
- The actual route generation is done with OSRM and brouter, those are run locally in docker containers.
|
||||
- The basemap is pulled from Stadia Maps. The usage of the script is well within the free tier, you'll need an API key from them.
|
||||
|
||||
## Data sources
|
||||
@ -22,8 +22,17 @@ This script will generate a few figures:
|
||||

|
||||
|
||||
## Using make
|
||||
The command `make route_analysis` will run *route_analysis.Rmd* which
|
||||
is an R markdown file containing the original R script *route_analysis.R*
|
||||
- `make osrm-data`: downloads the OpenStreetMap data for Wisconsin, and preproccesses it for use with OSRM.
|
||||
- `make osrm-container`: starts the OSRM containers (backends and frontends) for walking and biking.
|
||||
- `make brouter-data`: clones the repositories for brouter and brouter-web and downloads the segment data. It also builds the docker images for brouter and brouter-web.
|
||||
- `make brouter-container`: starts the brouter containers (backend and frontend).
|
||||
- `make walk` will run *route_analysis.Rmd* which
|
||||
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.
|
||||
|
||||
## Misc.
|
||||
- [Bike Level of Traffic Stress (LTS)](https://www.dvrpc.org/webmaps/bike-lts/analysis/)
|
||||
|
||||
## OpenStreetMap Data
|
||||
- [wisconsin-latest.osm.pbf](https://download.geofabrik.de/north-america/us/wisconsin-latest.osm.pbf)
|
||||
|
@ -155,7 +155,7 @@ routes <- bind_rows(routes)
|
||||
```
|
||||
|
||||
Notes:
|
||||
- _osrmRoute_ is the primary function used above.
|
||||
- this queries the brouter server to get routes
|
||||
|
||||
|
||||
## Combine routes with Bike LTS
|
||||
|
10
docker/brouter/.gitignore
vendored
Normal file
10
docker/brouter/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
|
||||
# Except the list of relevant segments
|
||||
!segments.csv
|
||||
|
||||
# Except docker-compose.yml
|
||||
!docker-compose.yml
|
26
docker/brouter/docker-compose.yml
Normal file
26
docker/brouter/docker-compose.yml
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
services:
|
||||
brouter:
|
||||
container_name: brouter
|
||||
ports:
|
||||
- 17777:17777
|
||||
volumes:
|
||||
- ./brouter/misc/segments4:/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
|
4
docker/brouter/segments.csv
Normal file
4
docker/brouter/segments.csv
Normal file
@ -0,0 +1,4 @@
|
||||
https://brouter.de/brouter/segments4/W90_N40.rd5
|
||||
https://brouter.de/brouter/segments4/W90_N45.rd5
|
||||
https://brouter.de/brouter/segments4/W95_N40.rd5
|
||||
https://brouter.de/brouter/segments4/W95_N45.rd5
|
|
10
docker/osrm/.gitignore
vendored
Normal file
10
docker/osrm/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
!docker-compose.yml
|
||||
!docker-compose-2.yml
|
||||
!preprocess.sh
|
||||
!data-raw/
|
||||
!data-foot/
|
||||
!data-bicycle/
|
4
docker/osrm/data-bicycle/.gitignore
vendored
Normal file
4
docker/osrm/data-bicycle/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
4
docker/osrm/data-foot/.gitignore
vendored
Normal file
4
docker/osrm/data-foot/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
4
docker/osrm/data-raw/.gitignore
vendored
Normal file
4
docker/osrm/data-raw/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
32
docker/osrm/docker-compose.yml
Normal file
32
docker/osrm/docker-compose.yml
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
services:
|
||||
osrm-backend-foot:
|
||||
container_name: osrm-backend-foot
|
||||
ports:
|
||||
- 5000:5000
|
||||
volumes:
|
||||
- ./data-foot:/data
|
||||
- ./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf
|
||||
image: osrm/osrm-backend
|
||||
command: osrm-routed --algorithm mld /data/wisconsin-latest.osrm
|
||||
osrm-backend-bicycle:
|
||||
container_name: osrm-backend-bicycle
|
||||
ports:
|
||||
- 5001:5000
|
||||
volumes:
|
||||
- ./data-bicycle:/data
|
||||
- ./data-raw/wisconsin-latest.osm.pbf:/data/wisconsin-latest.osm.pbf
|
||||
image: osrm/osrm-backend
|
||||
command: osrm-routed --algorithm mld /data/wisconsin-latest.osrm
|
||||
osrm-frontend-foot:
|
||||
ports:
|
||||
- 9966:9966
|
||||
environment:
|
||||
OSRM_BACKEND: 'http://localhost:5000'
|
||||
image: osrm/osrm-frontend
|
||||
osrm-frontend-bicycle:
|
||||
ports:
|
||||
- 9967:9966
|
||||
environment:
|
||||
OSRM_BACKEND: 'http://localhost:5001'
|
||||
image: osrm/osrm-frontend
|
Loading…
x
Reference in New Issue
Block a user