diff --git a/.gitignore b/.gitignore index da4a557..a609cd0 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,4 @@ api_key R/route_analysis.html log/ # Exclude html files generated in the top directory (from RStudio runs) -*.html +./*.html diff --git a/README.md b/README.md index 0adf224..929db12 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,9 @@ This script will generate a few figures: ### A map of all the walking routes within the walk boundary: ![example routes figure](examples/example-routes.png) -### A map of those walking routes colored by the level of traffic stress to bike +### A map of those routes colored by the level of traffic stress to bike ![example routes-lts figure](examples/example-routes-lts.png) -### A map of cycling routes colored by the level of traffic stress to bike (with a 3 mile radius) -![example routes-lts figure](examples/example-routes-lts_cycling.png) - ## Using make - `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. diff --git a/cycling_route_analysis.Rmd b/cycling_route_analysis.Rmd index 7116a91..3e9afaa 100644 --- a/cycling_route_analysis.Rmd +++ b/cycling_route_analysis.Rmd @@ -140,7 +140,7 @@ Notes: ## Combine routes with Bike LTS -```{r ltscount, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} +```{r routeslts, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} # Count the routes that intersect or overlap with each segment of the bike_tls network. # The intersections have a buffer of 20m @@ -148,9 +148,11 @@ bike_lts_buffer <- st_buffer(st_intersection(bike_lts, cycle_boundary_poly), 20) bike_lts_buffer["student_use"] <- unlist(lapply(st_intersects(bike_lts_buffer, routes), length)) -bike_lts <- left_join(bike_lts, as.data.frame(bike_lts_buffer %>% select(OBJECTID, student_use)), by = "OBJECTID") +bike_lts <- st_join(bike_lts, bike_lts_buffer %>% select(OBJECTID, student_use)) ``` -Notes: for each segment in bike_lts, this counts how many student's calculated routes intersect with it (within a 20 m buffer) + +Notes: + # Make Maps diff --git a/cycling_route_analysis_brouter.Rmd b/cycling_route_analysis_brouter.Rmd index 86f78d6..c3fcfd7 100644 --- a/cycling_route_analysis_brouter.Rmd +++ b/cycling_route_analysis_brouter.Rmd @@ -162,7 +162,7 @@ Notes: ## Combine routes with Bike LTS -```{r ltscount, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} +```{r routeslts, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} # Count the routes that intersect or overlap with each segment of the bike_tls network. # The intersections have a buffer of 20m @@ -170,23 +170,11 @@ bike_lts_buffer <- st_buffer(st_intersection(bike_lts, cycle_boundary_poly), 20) bike_lts_buffer["student_use"] <- unlist(lapply(st_intersects(bike_lts_buffer, routes), length)) -bike_lts <- left_join(bike_lts, as.data.frame(bike_lts_buffer %>% select(OBJECTID, student_use)), by = "OBJECTID") +bike_lts <- st_join(bike_lts, bike_lts_buffer %>% select(OBJECTID, student_use)) ``` -Notes: for each segment in bike_lts, this counts how many student's calculated routes intersect with it (within a 20 m buffer) +Notes: -```{r routeslts, eval = FALSE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} -routes_lts <-list(NULL) -for(i in addresses_near %>% arrange(number) %>% pull(number)) { - lts_segments <- st_intersects(routes %>% filter(student_number == i), bike_lts_buffer) - lts_max <- max(bike_lts_buffer %>% filter(OBJECTID.x )) - routes_lts[[i]] <- routes_lts_run - message(paste0("done - ", i, " of ", max(addresses_near$number))) -} -routes_lts <- bind_rows(routes_lts) -``` - -Notes: for each student's route, this finds which bike_lts segment it intersects with and calculates a max and an average # Make Maps diff --git a/examples/example-addresses.png b/examples/example-addresses.png index ebdccac..d73ca88 100644 Binary files a/examples/example-addresses.png and b/examples/example-addresses.png differ diff --git a/examples/example-routes-lts.png b/examples/example-routes-lts.png index c6a3366..c2799f9 100644 Binary files a/examples/example-routes-lts.png and b/examples/example-routes-lts.png differ diff --git a/examples/example-routes-lts_cycling.png b/examples/example-routes-lts_cycling.png deleted file mode 100644 index 0048b75..0000000 Binary files a/examples/example-routes-lts_cycling.png and /dev/null differ diff --git a/examples/example-routes.png b/examples/example-routes.png index b0d8682..37c04b2 100644 Binary files a/examples/example-routes.png and b/examples/example-routes.png differ diff --git a/route_analysis.Rmd b/route_analysis.Rmd index 35d189f..07ba8c3 100644 --- a/route_analysis.Rmd +++ b/route_analysis.Rmd @@ -114,7 +114,7 @@ routes <- bind_rows(routes) ## Combine routes with Bike LTS -```{r ltscount, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} +```{r routeslts, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} # Count the routes that intersect or overlap with each segment of the bike_tls network. # The intersections have a buffer of 20m @@ -122,9 +122,8 @@ bike_lts_buffer <- st_buffer(st_intersection(bike_lts, walk_boundary_poly), 20) bike_lts_buffer["student_use"] <- unlist(lapply(st_intersects(bike_lts_buffer, routes), length)) -bike_lts <- left_join(bike_lts, as.data.frame(bike_lts_buffer %>% select(OBJECTID, student_use)), by = "OBJECTID") +bike_lts <- st_join(bike_lts, bike_lts_buffer %>% select(OBJECTID, student_use)) ``` -Notes: for each segment in bike_lts, this counts how many student's calculated routes intersect with it (within a 20 m buffer) # Make Maps