removed unnecessary st_transform steps
This commit is contained in:
parent
8748e0fa69
commit
49eba8eb71
@ -7,6 +7,8 @@ output:
|
||||
toc_float:
|
||||
collapsed: false
|
||||
smooth_scroll: true
|
||||
editor_options:
|
||||
chunk_output_type: console
|
||||
---
|
||||
|
||||
```{r libs, eval = TRUE, echo = TRUE, results = "show", warning = FALSE, error = TRUE, message = FALSE}
|
||||
@ -51,7 +53,7 @@ register_stadiamaps(key = substr(read_file(file = "api_keys/stadia_api_key"), 1,
|
||||
|
||||
## subset addresses within 1.5 miles
|
||||
walk_boundary_poly <- fill_holes(st_make_valid(osrmIsodistance(
|
||||
loc = st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326),
|
||||
loc = WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE),
|
||||
breaks = c(walk_boundary_m),
|
||||
res = 80)
|
||||
), units::set_units(1, km^2))
|
||||
@ -94,7 +96,7 @@ logo <- image_read(path = "other/BFW_Logo_180_x_200_transparent_background.png")
|
||||
school_symbol <- image_read_svg(path = "other/school_FILL0_wght400_GRAD0_opsz24.svg")
|
||||
|
||||
|
||||
bbox <- st_bbox(st_transform(st_buffer(walk_boundary_poly, dist = 500), crs = 4326))
|
||||
bbox <- st_bbox(st_buffer(walk_boundary_poly, dist = 500))
|
||||
bbox <- c(left = as.double(bbox[1]),
|
||||
bottom = as.double(bbox[2]),
|
||||
right = as.double(bbox[3]),
|
||||
@ -130,11 +132,11 @@ ggmap(basemap) +
|
||||
scale_linewidth_continuous(range = c(0, 3)) +
|
||||
annotation_raster(school_symbol,
|
||||
# Position adjustments here using plot_box$max/min/range
|
||||
ymin = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[2] - 0.001,
|
||||
ymax = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[2] + 0.001,
|
||||
xmin = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[1] - 0.0015,
|
||||
xmax = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[1] + 0.0015) +
|
||||
geom_sf_label(data = st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326),
|
||||
ymin = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[2] - 0.001,
|
||||
ymax = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[2] + 0.001,
|
||||
xmin = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[1] - 0.0015,
|
||||
xmax = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[1] + 0.0015) +
|
||||
geom_sf_label(data = WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE),
|
||||
inherit.aes = FALSE,
|
||||
mapping = aes(label = school_focus %>% pull(name)),
|
||||
nudge_y = 0.0015,
|
||||
@ -178,11 +180,11 @@ ggmap(basemap) +
|
||||
scale_linewidth_continuous(range = c(0, 3)) +
|
||||
annotation_raster(school_symbol,
|
||||
# Position adjustments here using plot_box$max/min/range
|
||||
ymin = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[2] - 0.001,
|
||||
ymax = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[2] + 0.001,
|
||||
xmin = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[1] - 0.0015,
|
||||
xmax = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[1] + 0.0015) +
|
||||
geom_sf_label(data = st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326),
|
||||
ymin = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[2] - 0.001,
|
||||
ymax = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[2] + 0.001,
|
||||
xmin = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[1] - 0.0015,
|
||||
xmax = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[1] + 0.0015) +
|
||||
geom_sf_label(data = WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE),
|
||||
inherit.aes = FALSE,
|
||||
mapping = aes(label = school_focus %>% pull(name)),
|
||||
nudge_y = 0.0015,
|
||||
@ -222,11 +224,11 @@ ggmap(basemap) +
|
||||
new_scale_color() +
|
||||
annotation_raster(school_symbol,
|
||||
# Position adjustments here using plot_box$max/min/range
|
||||
ymin = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[2] - 0.001,
|
||||
ymax = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[2] + 0.001,
|
||||
xmin = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[1] - 0.0015,
|
||||
xmax = as.double((st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326) %>% pull(geom))[[1]])[1] + 0.0015) +
|
||||
geom_sf_label(data = st_transform(WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE), crs = 4326),
|
||||
ymin = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[2] - 0.001,
|
||||
ymax = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[2] + 0.001,
|
||||
xmin = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[1] - 0.0015,
|
||||
xmax = as.double((WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE) %>% pull(geom))[[1]])[1] + 0.0015) +
|
||||
geom_sf_label(data = WI_schools %>% filter(NCES_CODE %in% school_focus$NCES_CODE),
|
||||
inherit.aes = FALSE,
|
||||
mapping = aes(label = school_focus %>% pull(name)),
|
||||
nudge_y = 0.0015,
|
||||
|
1876
R/route_analysis.html
Normal file
1876
R/route_analysis.html
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user