Created
February 14, 2022 17:06
-
-
Save elipousson/b0dc56d888f6c5df6fe1c7f887e8abad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(overedge) | |
| program_number <- 237 | |
| buffer_dist <- 402.336 | |
| bbox_dist <- buffer_dist * 2 | |
| neatline_dist <- buffer_dist * 1.75 | |
| basemap_scale <- 0.75 | |
| asp <- "8:10.5" | |
| mapbox_crs <- 3857 | |
| location <- | |
| get_location( | |
| type = bcpss::bcps_programs_SY2021, | |
| id = program_number, | |
| id_col = "program_number" | |
| ) | |
| label <- janitor::make_clean_names(location$program_name_short) | |
| location_bbox_adj_3857 <- | |
| st_bbox_adj( | |
| x = location, | |
| dist = bbox_dist, | |
| asp = asp, | |
| crs = mapbox_crs | |
| ) | |
| basemap <- | |
| ggplot2::ggplot() + | |
| snapbox::layer_mapbox( | |
| area = location_bbox_adj_3857, | |
| map_style = "mapbox://styles/elipousson/ckzmwhvjd000h14mn6zw19y4j", | |
| mapbox_api_access_token = Sys.getenv("MAPBOX_ACCESS_TOKEN"), | |
| scale_ratio = basemap_scale | |
| ) | |
| basemap + | |
| layer_location_data( | |
| data = location, | |
| geom = "icon", | |
| icon = "school", | |
| source = "mapbox/maki", | |
| size = 6, | |
| crs = mapbox_crs | |
| ) + | |
| layer_location_data( | |
| data = st_buffer_ext(location, dist = buffer_dist), | |
| crs = mapbox_crs, | |
| linetype = "dashed", | |
| color = "black", | |
| fill = NA | |
| ) + | |
| layer_neatline( | |
| data = location, | |
| dist = neatline_dist, | |
| asp = asp, | |
| expand = TRUE, | |
| crs = mapbox_crs | |
| ) | |
| ggplot2::ggsave( | |
| filename = glue::glue("{label}_pedestrian_activity_basemap.pdf"), | |
| width = 8.5, | |
| height = 11 | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment