Compare commits

..

6 Commits

Author SHA1 Message Date
Ben Varick
338e608d92
edited examples and readme with new figures 2024-11-05 09:55:03 -06:00
Ben Varick
4330687ed2
edited typo 2024-11-05 09:46:03 -06:00
Ben Varick
9959536378
changed name to ltscount (from routeslts) to match cycling_route_analysis_brouter.Rmd 2024-11-05 09:37:05 -06:00
Ben Varick
b19add99ac
fixed erroneous join 2024-11-05 09:35:37 -06:00
Ben Varick
1f27a017af
edited .gitignore 2024-11-05 09:34:30 -06:00
Ben Varick
6600f0cd74
Fixed erroneous join with bike_lts, added new chunk for calculating average lts per address 2024-11-05 09:33:46 -06:00
9 changed files with 26 additions and 12 deletions

2
.gitignore vendored
View File

@ -22,4 +22,4 @@ api_key
R/route_analysis.html R/route_analysis.html
log/ log/
# Exclude html files generated in the top directory (from RStudio runs) # Exclude html files generated in the top directory (from RStudio runs)
./*.html *.html

View File

@ -18,9 +18,12 @@ This script will generate a few figures:
### A map of all the walking routes within the walk boundary: ### A map of all the walking routes within the walk boundary:
![example routes figure](examples/example-routes.png) ![example routes figure](examples/example-routes.png)
### A map of those routes colored by the level of traffic stress to bike ### A map of those walking routes colored by the level of traffic stress to bike
![example routes-lts figure](examples/example-routes-lts.png) ![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 ## Using make
- `make osrm-data`: downloads the OpenStreetMap data for Wisconsin, and preproccesses it for use with OSRM. - `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 osrm-container`: starts the OSRM containers (backends and frontends) for walking and biking.

View File

@ -140,7 +140,7 @@ Notes:
## Combine routes with Bike LTS ## Combine routes with Bike LTS
```{r routeslts, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} ```{r ltscount, 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. # Count the routes that intersect or overlap with each segment of the bike_tls network.
# The intersections have a buffer of 20m # The intersections have a buffer of 20m
@ -148,11 +148,9 @@ 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_buffer["student_use"] <- unlist(lapply(st_intersects(bike_lts_buffer, routes), length))
bike_lts <- st_join(bike_lts, bike_lts_buffer %>% select(OBJECTID, student_use)) bike_lts <- left_join(bike_lts, as.data.frame(bike_lts_buffer %>% select(OBJECTID, student_use)), by = "OBJECTID")
``` ```
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 # Make Maps

View File

@ -162,7 +162,7 @@ Notes:
## Combine routes with Bike LTS ## Combine routes with Bike LTS
```{r routeslts, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} ```{r ltscount, 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. # Count the routes that intersect or overlap with each segment of the bike_tls network.
# The intersections have a buffer of 20m # The intersections have a buffer of 20m
@ -170,11 +170,23 @@ 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_buffer["student_use"] <- unlist(lapply(st_intersects(bike_lts_buffer, routes), length))
bike_lts <- st_join(bike_lts, bike_lts_buffer %>% select(OBJECTID, student_use)) bike_lts <- left_join(bike_lts, as.data.frame(bike_lts_buffer %>% select(OBJECTID, student_use)), by = "OBJECTID")
``` ```
Notes: Notes: for each segment in bike_lts, this counts how many student's calculated routes intersect with it (within a 20 m buffer)
```{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 # Make Maps

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 MiB

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

View File

@ -114,7 +114,7 @@ routes <- bind_rows(routes)
## Combine routes with Bike LTS ## Combine routes with Bike LTS
```{r routeslts, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE} ```{r ltscount, 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. # Count the routes that intersect or overlap with each segment of the bike_tls network.
# The intersections have a buffer of 20m # The intersections have a buffer of 20m
@ -122,8 +122,9 @@ 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_buffer["student_use"] <- unlist(lapply(st_intersects(bike_lts_buffer, routes), length))
bike_lts <- st_join(bike_lts, bike_lts_buffer %>% select(OBJECTID, student_use)) bike_lts <- left_join(bike_lts, as.data.frame(bike_lts_buffer %>% select(OBJECTID, student_use)), by = "OBJECTID")
``` ```
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 # Make Maps